我正在使用以下文档的帮助http://tutos.readthedocs.io/en/latest/source/ndg.html并尝试运行服务器。我在站点中启用了以下文件:
upstream test_server {
server unix:/var/www/test/run/gunicorn.sock fail_timeout=10s;
}
# This is not neccessary - it's just commonly used
# it just redirects example.com -> www.example.com
# so it isn't treated as two separate websites
server {
listen 80;
server_name dehatiengineers.in;
return 301 $scheme://www.dehatiengineers.in$request_uri;
}
server {
listen 80;
server_name www.dehatiengineer.in;
client_max_body_size 4G;
access_log /var/www/test/logs/nginx-access.log;
error_log /var/www/test/logs/nginx-error.log warn;
location /static/ {
autoindex on;
alias /var/www/test/ourcase/static/;
}
location /media/ {
autoindex on;
alias /var/www/test/ourcase/media/;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://test_server;
break;
}
}
#For favicon
location /favicon.ico {
alias /var/www/test/test/static/img/favicon.ico;
}
#For robots.txt
location /robots.txt {
alias /var/www/test/test/static/robots.txt ;
}
# Error pages
error_page 500 502 503 504 /500.html;
location = /500.html {
root /var/www/test/ourcase/static/;
}
}
我的服务器的域名是dehatiengineers.in
。在
gunicorn_start.sh
文件是:
现在,我正在运行nginx和gunicorn_start.sh
文件。nginx正在运行,您可以在http://www.dehatiengineers.in/
上看到,但是django没有连接到nginx。现在在sudo sh gunicorn_start.sh
上,我得到以下输出:
Starting ourcase as root
gunicorn_start.sh: 16: gunicorn_start.sh: source: not found
[2016-05-20 06:21:45 +0000] [10730] [INFO] Starting gunicorn 19.5.0
[2016-05-20 06:21:45 +0000] [10730] [INFO] Listening at: unix:/var/www/test/run/gunicorn.sock (10730)
[2016-05-20 06:21:45 +0000] [10730] [INFO] Using worker: sync
[2016-05-20 06:21:45 +0000] [10735] [INFO] Booting worker with pid: 10735
但是,在浏览器中,我只是得到nginx的输出,而不是原来的输出。在
除此之外,我在运行gunicorn_ourcase.service
文件时遇到问题:
[Unit]
Description=Ourcase gunicorn daemon
[Service]
Type=simple
User=root
ExecStart=/var/www/test/gunicorn_start.sh
[Install]
WantedBy=multi-user.target
运行问题:
$ systemctl enable gunicorn_ourcase
systemctl: command not found
请帮我解决这个问题。在
我所做的一切都很好,除了
nginx
正在使用它的默认配置文件。我不得不删除/编辑位于/etc/nginx/sites-enabled/
,名为default
的文件。编辑之后一切都很好。在相关问题 更多 >
编程相关推荐