Hello,
I have recently migrated from Apache 2.2 to nginx 1.08 stable on a Ubuntu 10.10 x64 machine. My /etc/nginx/sites-available/default is like this :-
server {
listen 80; ## listen for ipv4
server_name www.mydomain.com;
access_log /var/log/nginx/localhost.access.log;
location / {
root /var/www/html;
index index.html index.htm index.php;
try_files $uri $uri/ /index.php?q=$request_uri;
}
I have a download section at /var/www/html/downloads (or /downloads) and I have a autoindex PHP script to show all the files within the directory. Now normally there are some .mp3 and .mp4 files inside different folders and sub-folders under /downloads. Some of the directory was also symbolic links like /downloads/videos is symbolic to /media/hdd/videos. I want everyone to access all those folders and see the contents using the autoindex php script (which worked previously fine with apache) ..but cannot download them unless they are from 172.16.0.0/16. Previously I had two .htaccess files to do this. One is in / (root folder) which controls the .htaccess rules for the joomla site, another one in /downloads. The rules inside it are as follows:
ErrorDocument 403 /errors/downloads/403.php
<Files ~ "\.(mp3|mp4)$">
order deny,allow
allow from 172.16.0.0/16
deny from all
</Files>
I am trying to achieve the same with nginx. Can anyone point me to the right direction please?
Regards,
Saiful