解决 - nginx配置
nginx 最后的配置:
user root; worker_processes 4; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; include /etc/nginx/mime.types; default_type application/octet-stream; upstream django { server 127.0.0.1:8003; server 127.0.0.1:8004; # server 192.1.123.1; } server { listen 80; charset utf-8; # max upload size client_max_body_size 75M; location /static { alias /data/deploy/allstatic; } location / { uwsgi_pass django; include uwsgi_params; } } }
nginx反向代理:
默认
[root@oldboyedu-01 deploy]# vim /etc/nginx/nginx.conf # For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; # Load dynamic modules. See /usr/share/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; # Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. include /etc/nginx/conf.d/*.conf; }
一开始 怎么都找不到静态文件;

[root@oldboyedu-01 deploy]# ps -ef|grep nginx
root 3118 1 0 14:12 ? 00:00:00 nginx: master process nginx -c /etc/nginx/nginx.conf
root 3126 2907 0 14:14 pts/1 00:00:00 vim /etc/nginx/conf.d/default.conf
root 3153 3096 0 14:21 pts/2 00:00:00 tail -f /var/log/nginx/error.log
root 3165 3118 0 14:30 ? 00:00:00 nginx: worker process
root 3166 3118 0 14:30 ? 00:00:00 nginx: worker process
root 3167 3118 0 14:30 ? 00:00:00 nginx: worker process
root 3168 3118 0 14:30 ? 00:00:00 nginx: worker process
root 3170 2802 0 14:32 pts/0 00:00:00 grep nginx
---------------------------------------
vim /etc/nginx/nginx.conf
# For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ user root; worker_processes 4; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; # Load dynamic modules. See /usr/share/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf; # include /etc/nginx/conf.d/*.conf; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; upstream django { server 127.0.0.1:8002; } server { listen 80; charset utf-8; # max upload size client_max_body_size 75M; location /static/ { alias /data/deploy/allstatic/; # alias /data/html; # alias /data/; } location / { uwsgi_pass django; include uwsgi_params; } } # Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. include /etc/nginx/conf.d/*.conf; }
去查看错误日志记录:

前面加了一些不该加的 链接
在返回来看 哪里加的

找到罪魁祸首


当:bind() to 0.0.0.0:8001 failed
sudo nginx -t -c /etc/nginx/nginx.conf
当:open() "/var/run/nginx.pid"
nginx -c /etc/nginx/nginx.conf
service nginx stop
service nginx start
[root@oldboyedu-01 /]# nginx -s stop
[root@oldboyedu-01 /]# nginx -c /etc/nginx/nginx.conf
[root@oldboyedu-01 /]# chmod 777 /data/ 修改权限

[root@oldboyedu-01 /]# vim /etc/nginx/nginx.conf default_type application/octet-stream; upstream django { server 127.0.0.1:8002; } server { listen 80; charset utf-8; # max upload size client_max_body_size 75M; location /static/ { alias /data/deploy/allstatic/; } location / { uwsgi_pass django; include uwsgi_params; } } # Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. include /etc/nginx/conf.d/*.conf;
}
错误日志

https://www.cnblogs.com/knowledgesea/p/5175711.html
https://blog.csdn.net/chinabestchina/article/details/73556785
https://www.jianshu.com/p/6c37abcf2e3d
https://blog.csdn.net/onlysunnyboy/article/details/75270533
yum安装:
# yum install 包名
yum卸载:
# yum -y remove 包名
浙公网安备 33010602011771号