I have a site running on Nginx (v1.0.14) serving as reverse proxy which proxies requests to Apache (v2.2.19). So Nginx runs on port 80, Apache is on 8080.
Overall site works fine except that i cannot block access to certain directories with .htaccess file.
For example i have ‘my-protected-directory’ on ‘www.site.com’
Inside it i have htaccess with following code:
<Files *> order deny,allow deny from all allow from 126.96.36.199 <--- my ip address here </Files>
When i try to access this page with my ip (188.8.131.52) i get 404 error which is not what i expect:
However everything works as expected when this page is served directly by Apache. I can see this page, everyone else can’t.
Nginx config (184.108.40.206 is site ip.):
Update 2: mod_rpaf is installed and ip address get determined correctly
Could please anyone tell me what is wrong and how this can be fixed ?
You placed the
root directive under
location instead of
server. This is one of the most common nginx misconfigurations. And in this case it will be directly responsible for your 404 error.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.