我使用NGINX+GUNICORN+DJANGO,我的GUNICORN状态为active。
我想用django建立nginx。
我在/etc/nginx/sites-available
中创建了一个名为'mysite'
的新文件
server {
listen 8000 default_server;
listen [::]:8000 default_server;
server_name my_ip;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/split/mysite;
}
location / {
include proxy_params;
proxy_pass http://unix:/home/split/mysite/mysite.sock;
}
}
保存它并创建到/etc/nginx/sites-enabled
的symbolyc链接
在那之后,我做了sudo service nginx restart
得到了这个:
我去了journalctl -xe
--
-- Unit nginx.service has finished shutting down.
Dec 07 01:05:17 ubuntu systemd[1]: Starting A high performance web server and a reverse proxy server...
-- Subject: Unit nginx.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit nginx.service has begun starting up.
Dec 07 01:05:17 ubuntu nginx[49646]: nginx: [crit] pread() "/etc/nginx/sites-enabled/sites-available" failed (21: Is a directory)
Dec 07 01:05:17 ubuntu nginx[49646]: nginx: configuration file /etc/nginx/nginx.conf test failed
Dec 07 01:05:17 ubuntu systemd[1]: nginx.service: Control process exited, code=exited status=1
Dec 07 01:05:17 ubuntu sudo[49639]: pam_unix(sudo:session): session closed for user root
Dec 07 01:05:17 ubuntu systemd[1]: FAILED TO START A HIGH PERFORMANCE WEB SERVER AND A REVERSE PROXY SERVER.
-- Subject: Unit nginx.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit nginx.service has failed.
--
-- The result is failed.
Dec 07 01:05:17 ubuntu systemd[1]: nginx.service: Unit entered failed state.
Dec 07 01:05:17 ubuntu systemd[1]: nginx.service: Failed with result 'exit-code'.
Dec 07 01:05:42 ubuntu kernel: [UFW BLOCK] IN=eth0 OUT= MAC=02:1e:6d:00:e4:9f:00:01:e8:11:73:69:08:00 SRC=193.124.0.226 DST=194.87.95.46 LEN=48 TOS=0
Dec 07 01:05:57 ubuntu kernel: [UFW BLOCK] IN=eth0 OUT= MAC=02:1e:6d:00:e4:9f:00:01:e8:11:73:69:08:00 SRC=193.124.0.226 DST=194.87.95.46 LEN=52 TOS=0
Dec 07 01:06:16 ubuntu kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:00:21:d7:56:a5:80:08:00 SRC=93.95.100.9 DST=224.0.0.1 LEN=32 TOS=0x00 P
Dec 07 01:06:21 ubuntu sudo[49655]: split : TTY=pts/0 ; PWD=/etc/nginx ; USER=root ; COMMAND=/bin/journalctl -xe
Dec 07 01:06:21 ubuntu sudo[49655]: pam_unix(sudo:session): session opened for user root by split(uid=0)
Dec 07 01:06:39 ubuntu kernel: [UFW BLOCK] IN=eth0 OUT= MAC=02:1e:6d:00:e4:9f:00:01:e8:11:73:69:08:00 SRC=193.124.0.226 DST=194.87.95.46 LEN=52 TOS=0
Dec 07 01:07:16 ubuntu kernel: [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:00:21:d7:56:a5:80:08:00 SRC=93.95.100.9 DST=224.0.0.1 LEN=32 TOS=0x00 P
Dec 07 01:07:17 ubuntu kernel: [UFW BLOCK] IN=eth0 OUT= MAC=02:1e:6d:00:e4:9f:00:01:e8:11:73:69:08:00 SRC=185.207.206.224 DST=194.87.95.46 LEN=40 TOS
Dec 07 01:07:46 ubuntu kernel: [UFW BLOCK] IN=eth0 OUT= MAC=02:1e:6d:00:e4:9f:00:01:e8:11:73:69:08:00 SRC=212.16.70.23 DST=194.87.95.46 LEN=40 TOS=0x
Dec 07 01:08:03 ubuntu sudo[49662]: split : TTY=pts/0 ; PWD=/etc/nginx ; USER=root ; COMMAND=/bin/su
Dec 07 01:08:03 ubuntu sudo[49662]: pam_unix(sudo:session): session opened for user root by split(uid=0)
Dec 07 01:08:03 ubuntu su[49663]: Successful su for root by root
Dec 07 01:08:03 ubuntu su[49663]: + /dev/pts/0 root:root
Dec 07 01:08:03 ubuntu su[49663]: pam_unix(su:session): session opened for user root by split(uid=0)
这是我和uwsgi一起使用的项目草稿,对我来说效果很好。换个地址就行了 还有一件事,把socket权限更改为664
相关问题 更多 >
编程相关推荐