None of the configurations that I've looked up can help with setting up Nginx to serve PHP files on a mounted USB folder. I'm currently getting file not found
when I try and access a PHP file on the USB but PHP displays correctly when accessing it on the default folder /usr/share/nginx/www
.
In other words, If I have a test.php
in /media/usb/downloads/
and try to access sitename.com/usb/test.php
I get file not found
. But, if i place it in /usr/share/nginx/www/
it works. In both cases, static files work fine.
I have installed nginx and php5-fpm with defaults but added the following changes:
nginx/sites-enabled/default
location /usb/ {
alias /media/usb/downloads/;
autoindex on;
allow 127.0.0.1;
allow ::1;
#deny all;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
}