Answer the question
In order to leave comments, you need to log in
Can't change root in nginx, why?
Hello everyone, I'm trying to set up nginx to share an application:
there are 2 directories with applications:
/var/www/neel/appRlLara/public;
/var/www/neel/appRlLara/legacy;
I want the URL:
neel_rl.neel/ used on /var/www/neel/appRlLara/legacy;
and for all routes neel_rl.neel/appRlLara used in /var/www/neel/appRlLara/public;
tried like this:
server {
server_name neel_rl.neel;
location /appRlLara {
root /var/www/neel;
try_files $uri /appRlLara/public/index.php$is_args$args;
}
location / {
root /var/www/neel/appRlLara/legacy;
}
index index.html index.htm index.php;
location ~ \.php$ {
fastcgi_pass rl.php54:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
error_log /var/log/nginx/neel_error.log;
access_log /var/log/nginx/neel_access.log;
}
server {
server_name neel_rl.neel;
root /var/www/neel;
location /appRlLara {
try_files $uri /appRlLara/public/index.php$is_args$args;
}
index index.html index.htm index.php;
client_max_body_size 50m;
location ~ \.php$ {
fastcgi_pass rl.php54:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
error_log /var/log/nginx/neel_error.log;
access_log /var/log/nginx/neel_access.log;
}
Answer the question
In order to leave comments, you need to log in
server {
server_name neel_rl.neel;
root /var/www/neel/appRlLara/legacy;
location / {
try_files $uri /index.php$is_args$args;
location ~ \.php$ {
fastcgi_pass rl.php54:9000;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
}
location /appRlLara {
root /var/www/neel/appRlLara/public;
rewrite ^/appRlLara/(.*) /$1 break;
try_files $uri /appRlLara/index.php$is_args$args;
location ~ \.php$ {
rewrite ^/appRlLara/(.*) /$1 break;
fastcgi_pass rl.php54:9000;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question