链接nginx配置和安装

时间:2013-09-02 09:03:48

标签: shell web nginx debian

我正在尝试使用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,好像什么都没有运行。谁能告诉我我做错了什么?

1 个答案:

答案 0 :(得分:2)

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

您需要将其链接到已启用网站且不可用 - 并且它可能适合您。

为清晰起见,我也不会更改配置文件的名称:

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

会让它发挥作用

看起来你正在做自己的一些配置管理,你看看木偶,厨师,cfengine,saltstack?