0

我正在尝试使用 shell 脚本安装 nginx,但似乎我犯了一个错误:

# INSTALL NGINX
apt-get install nginx
# LINK CONFIGURATION FILE
ln -fs /etc/configuration/nginx/nginx/app.conf /etc/nginx/sites-available/app
ln -fs /etc/configuration/nginx/nginx/nginx.conf /etc/nginx/nginx.conf
# RESTART
service nginx restart

我的 app.conf 配置如下:

server { 
    listen 80; 
    root /home/deploy/project123; 
    server_name www.project123.com;
    location / { try_files $uri @app; }
    location @app {
        include uwsgi_params;
        uwsgi_pass unix:/tmp/uwsgi.sock;
    }
}

我的 nginx.conf 是这样的:

user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
      worker_connections  1024;
}

http {
      include /etc/nginx/mime.types;
      access_log /var/log/nginx/access.log;
      include /etc/nginx/conf.d/*.conf;
      include /etc/nginx/sites-enabled/*;
}

我的代码在:/home/deploy/project123

当我访问该站点时,我得到一个 404,好像没有运行一样。谁能告诉我我做错了什么?

4

1 回答 1

5
ln -fs /etc/configuration/nginx/nginx/app.conf /etc/nginx/sites-available/app

您需要将其链接到已启用且不可用的站点 - 它可能对您有用。

为了清楚起见,我也不会更改 conf 文件的名称:

ln -fs /etc/configuration/nginx/nginx/app.conf /etc/nginx/sites-enabled/ 

会让它工作

看起来你正在做一些自己的配置管理,你检查过 puppet、chef、cfengine、saltstack 吗?

于 2013-09-07T09:01:45.410 回答