Multiple applications in the same domain Nginx

3

Good morning people, I'm breaking my head here.

I have a server with nginx and it has two applications:

1 - Application Laravel / usr / share / nginx / html / laravel / public

2 - Joomla Application / usr / share / nginx / html / joomla

The application in Laravel is the main one that should be accessed in ' link ' and the joomla should be accessed in ' link '.

Below is the default configuration code:

server {
listen 80;
listen [::]:80 ipv6only=on;

root /usr/share/nginx/html/laravel/public;
index index.php index.html index.htm default.html default.htm;

server_name 104.131.92.76;

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

location ~ /antigo/ {
    root /usr/share/nginx/html/joomla;
    index index.php index.html index.htm default.html default.htm;

    try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
    try_files $uri /index.php =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}
}

What am I doing wrong?

    
asked by anonymous 12.04.2015 / 19:08

1 answer

1

On line try_files $uri $uri/ /index.php?$args; you are sending all requests that give error dominio.com.br/antigo/* to dominio.com.br/index.php of your other application. This is an easy error to see.

If you're going to want to maintain optimal routing for both Joomla and laravel (instead of just keeping one connected) in the same domain, it can be pretty hard to make it work.

Here is documentation on how to do this using Joomla at the root of the domain link

    
05.06.2015 / 06:27