简体   繁体   English

在AWS上安装nginx之后禁止403(不欢迎使用nginx消息)

[英]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. 我在AWS上汇总了一个基本的ubuntu 10微实例,并使用apt-get和make等安装了它。

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. nginx正在运行,但是当我尝试访问ip进行测试时,它会返回403。工作进程正在以www-data的形式运行。 /var/www/nginx-default has 755 permissions and is owned by www-data as well. / var / www / nginx-default具有755权限,也由www-data拥有。

I found the solution by tweaking /etc/nginx/sites-available/default which is where the default server configuration is. 我通过调整/ etc / nginx / sites-available / default找到了解决方案,这是默认服务器配置所在的位置。 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. 在安装过程中创建的nginx-default目录误导了我。

Perhaps the real solution was changing the permissions on /var/www like I had for /var/www/nginx-default 也许真正的解决方案是像我对/ var / www / nginx-default一样更改/ var / www的权限

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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