简体   繁体   中英

403 forbidden after nginx install on AWS (no welcome to nginx message)

I rolled up a basic ubuntu 10 micro-instance on AWS and installed it with apt-get and make etc.

nginx is running but when I try to visit the ip to test it spits back a 403. The worker process is running as www-data. /var/www/nginx-default has 755 permissions and is owned by www-data as well.

I found the solution by tweaking /etc/nginx/sites-available/default which is where the default server configuration is. I stripped it down to almost nothing, and then realized the root path wasn't pointing where I thought it was.

server {
    listen 80;
    location / {
            root   /var/www;
    }

changed to

server {
    listen 80;
    location / {
            root   /var/www/nginx-default;
    }

The nginx-default directory that was created during install misled me.

Perhaps the real solution was changing the permissions on /var/www like I had for /var/www/nginx-default

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM