<div dir="ltr">Turns out this was my fault. I was using "sudo service nginx start" instead of just "sudo nginx." </div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Mar 23, 2014 at 5:35 PM, Steve Holdoway <span dir="ltr"><<a href="mailto:steve@greengecko.co.nz" target="_blank">steve@greengecko.co.nz</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Having just had a similar problem with migrating a MySQL database, I<br>
suggest that you check whether SELinux/Apparmor is running.<br>
<br>
Why prople think it's ok to use a program that can be switched off in an<br>
instant to improve their 'security' is and always will be a mystery to<br>
me!<br>
<br>
Cheers,<br>
<br>
Steve<br>
<div><div class="h5"><br>
On Sun, 2014-03-23 at 11:48 -0400, Adam Pearlman wrote:<br>
> I've been struggling with this for a few hours.<br>
><br>
> I installed nginx 1.4.6 on Fedora 20. The test page displayed fine. I<br>
> changed the root, leaving all other configuration the same, and I get<br>
> a 403 Forbidden error.<br>
><br>
> If I look at the permissions for the original test page and the new<br>
> page, they appear identical.<br>
><br>
> Working test page:<br>
> namei -om /usr/share/nginx/html/index.html<br>
> f: /usr/share/nginx/html/index.html<br>
> dr-xr-xr-x root root /<br>
> drwxr-xr-x root root usr<br>
> drwxr-xr-x root root share<br>
> drwxr-xr-x root root nginx<br>
> drwxr-xr-x root root html<br>
> -rw-r--r-- root root index.html<br>
><br>
> Not working:<br>
> namei -om /var/www/html/index.html<br>
> f: /var/www/html/index.html<br>
> dr-xr-xr-x root root /<br>
> drwxr-xr-x root root var<br>
> drwxr-xr-x root root www<br>
> drwxr-xr-x root root html<br>
> -rw-r--r-- root root index.html<br>
><br>
> The error log seems to be what I would expect as well:<br>
> 2014/03/23 12:45:08 [error] 5490#0: *13 open()<br>
> "/var/www/html/index.html" failed (13: Permission denied), client:<br>
> XXX.XX.XXX.XXX, server: localhost, request: "GET /index.html<br>
> HTTP/1.1", host: "<a href="http://ec2-XXX-XX-XXX-XXX.compute-1.amazonaws.com" target="_blank">ec2-XXX-XX-XXX-XXX.compute-1.amazonaws.com</a>"<br>
><br>
><br>
> The Nginx config has "user nginx" - I tried using root and it made no<br>
> difference. I also made user ngnix the owner & group of the files, but<br>
> that didn't work. If I move the index file from /var/www/html<br>
> to /usr/share/nginx/html (the test file location) it works fine making<br>
> me suspect the path, but as I said, permissions appear correct.<br>
><br>
><br>
> Any help would be very much appreciated. Thanks!<br>
><br>
><br>
> - Adam<br>
><br>
><br>
> I've included the config file below just in case:<br>
><br>
><br>
> # For more information on configuration, see:<br>
> # * Official English Documentation: <a href="http://nginx.org/en/docs/" target="_blank">http://nginx.org/en/docs/</a><br>
> # * Official Russian Documentation: <a href="http://nginx.org/ru/docs/" target="_blank">http://nginx.org/ru/docs/</a><br>
><br>
> user nginx;<br>
> worker_processes 1;<br>
><br>
> error_log /var/log/nginx/error.log;<br>
> #error_log /var/log/nginx/error.log notice;<br>
> #error_log /var/log/nginx/error.log info;<br>
><br>
> pid /run/nginx.pid;<br>
><br>
> events {<br>
> worker_connections 1024;<br>
> }<br>
><br>
> http {<br>
> include /etc/nginx/mime.types;<br>
> default_type application/octet-stream;<br>
><br>
> log_format main '$remote_addr - $remote_user [$time_local]<br>
> "$request" '<br>
> '$status $body_bytes_sent "$http_referer" '<br>
> '"$http_user_agent" "$http_x_forwarded_for"';<br>
><br>
> access_log /var/log/nginx/access.log main;<br>
><br>
> sendfile on;<br>
> #tcp_nopush on;<br>
><br>
> #keepalive_timeout 0;<br>
> keepalive_timeout 65;<br>
><br>
> #gzip on;<br>
><br>
> # Load modular configuration files from the /etc/nginx/conf.d<br>
> directory.<br>
> # See <a href="http://nginx.org/en/docs/ngx_core_module.html#include" target="_blank">http://nginx.org/en/docs/ngx_core_module.html#include</a><br>
> # for more information.<br>
> include /etc/nginx/conf.d/*.conf;<br>
><br>
> index index.html index.htm;<br>
><br>
> server {<br>
> listen 80;<br>
> server_name localhost;<br>
> root /usr/share/nginx/html; ################THIS WORKS<br>
> #root /var/www/html; #####################THIS DOESN'T<br>
><br>
> #charset koi8-r;<br>
><br>
> #access_log /var/log/nginx/host.access.log main;<br>
><br>
> location / {<br>
> }<br>
><br>
> # redirect server error pages to the static page /40x.html<br>
> #<br>
> error_page 404 /404.html;<br>
> location = /40x.html {<br>
> }<br>
><br>
> # redirect server error pages to the static page /50x.html<br>
> #<br>
> error_page 500 502 503 504 /50x.html;<br>
> location = /50x.html {<br>
> }<br>
><br>
> # proxy the PHP scripts to Apache listening on <a href="http://127.0.0.1:80" target="_blank">127.0.0.1:80</a><br>
> #<br>
> #location ~ \.php$ {<br>
> # proxy_pass <a href="http://127.0.0.1" target="_blank">http://127.0.0.1</a>;<br>
> #}<br>
><br>
> # pass the PHP scripts to FastCGI server listening on<br>
> <a href="http://127.0.0.1:9000" target="_blank">127.0.0.1:9000</a><br>
> #<br>
> #location ~ \.php$ {<br>
> # root html;<br>
> # fastcgi_pass <a href="http://127.0.0.1:9000" target="_blank">127.0.0.1:9000</a>;<br>
> # fastcgi_index index.php;<br>
> # fastcgi_param SCRIPT_FILENAME /scripts<br>
> $fastcgi_script_name;<br>
> # include fastcgi_params;<br>
> #}<br>
><br>
> # deny access to .htaccess files, if Apache's document root<br>
> # concurs with nginx's one<br>
> #<br>
> #location ~ /\.ht {<br>
> # deny all;<br>
> #}<br>
> }<br>
><br>
> # another virtual host using mix of IP-, name-, and port-based<br>
> configuration<br>
> #<br>
> #server {<br>
> # listen 8000;<br>
> # listen somename:8080;<br>
> # server_name somename alias another.alias;<br>
> # root html;<br>
><br>
> # location / {<br>
> # }<br>
> #}<br>
><br>
><br>
> # HTTPS server<br>
> #<br>
> #server {<br>
> # listen 443;<br>
> # server_name localhost;<br>
> # root html;<br>
><br>
> # ssl on;<br>
> # ssl_certificate cert.pem;<br>
> # ssl_certificate_key cert.key;<br>
><br>
> # ssl_session_timeout 5m;<br>
><br>
> # ssl_protocols SSLv2 SSLv3 TLSv1;<br>
> # ssl_ciphers HIGH:!aNULL:!MD5;<br>
> # ssl_prefer_server_ciphers on;<br>
><br>
> # location / {<br>
> # }<br>
> #}<br>
><br>
> }<br>
</div></div>> _______________________________________________<br>
> nginx mailing list<br>
> <a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
> <a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Steve Holdoway BSc(Hons) MIITP<br>
<a href="http://www.greengecko.co.nz" target="_blank">http://www.greengecko.co.nz</a><br>
Linkedin: <a href="http://www.linkedin.com/in/steveholdoway" target="_blank">http://www.linkedin.com/in/steveholdoway</a><br>
Skype: sholdowa<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</font></span></blockquote></div><br></div>