Answer the question
In order to leave comments, you need to log in
How to display the site on a subdirectory inside the nginx config?
Hello. There is a server, ubuntu on which nginx is spinning.
Directory with configs /etc/nginx/sites-primary/
Inside each site has its own config, the structure of which is something like this:
server {
listen 80;
server_name site1..com;
root /var/www/site1.com;
location / {
try_files $uri $uri/ @rewrite;
}
location /index.html {
rewrite / / permanent;
}
location ~ ^/(.*?)/index\.html$ {
rewrite ^/(.*?)/ // permanent;
}
location @rewrite {
rewrite ^/(.*)$ /index.php?q=$1;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass backend-valhalla;
}
location ~* ^.+\.(jpg|jpeg|gif|png|ico|bmp)$ {
#access_log off;
expires 10d;
error_page 404 = @fallback;
break;
}
location ~* ^.+\.(css|js)$ {
#access_log off;
charset utf-8;
expires epoch;
error_page 404 = @fallback;
break;
}
location @fallback {
rewrite ^/(.*)/[^/]+$ /editor/default.png redirect;
}
}
location ~* ^/control/ {
root /var/www/site1.com;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question