Question
nginx configuration: additional Location throws 404
I am trying to modify my drupal droplet nginx configuration to serve files from an another location.
/var/www/html/mysite <– already configured and works fine and is accessible through the webserver
/var/www/html/resources <– I want to configure the webserver to serve content from this directory
The modification I made in /etc/nginx/sites-available/drupal is not taking effect
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/html/mysite;
index index.php index.html index.htm;
.
.
.
location ~* ^/more/ {
root /var/www/html/resources;
index index.html index.htm;
try_files $uri $uri/ =404;
}
}
Still resources served from under the /resources is throwing 404
for e.g.
http://cfcindia.org/resources/en/books/pdf/AGF.pdf
what is the nginx configuration changes to serve files from /resources?
I am an nginx newbie, and have researched existing community questions, and the internet, but could not get it to work.
HELP!
Rabi
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×