[Tips] Fix new subdirectories for web page not available
(RuneAudio 20160313)
For those who want to add some additional webpages in new subdirectories.
The existing configuration of NGINX web server redirects all requests of certain file types to
/srv/http/assets/.
Any files of those types in other subdirectories will never be reached.
The lines that cause it:
/etc/nginx/nginx.conf
# rewrite RULES
rewrite /css/(.*) /assets/css/$1 break;
rewrite /less/(.*) /assets/less/$1 break;
rewrite /js/(.*) /assets/js/$1 break;
rewrite /img/(.*) /assets/img/$1 break;
rewrite /fonts/(.*) /assets/fonts/$1 break;
They were set as global rules.
Fix: Make the rules specific for root directory by move those lines inside:
server {
listen 80 deferred;
add_header X-UA-Compatible "IE=Edge,chrome=1";
access_log /var/log/runeaudio/runeui_access.log;
location / {
root /var/www;
index index.php index.html index.htm;
try_files $uri /index.php;
### MOVE HERE ###
}
...
After
systemctl restart nginx, all subdirectories will be reachable as they shoud be.