本文共 2274 字,大约阅读时间需要 7 分钟。
worker_processes auto;error_log /var/log/nginx/error.log;pid /run/nginx.pid;# ??????include /usr/share/doc/nginx/README.dynamic.include;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; # ?????? include /etc/nginx/conf.d/*.conf;} server { listen 80; server_name www.yblisgglib.online; # ???????HTTPS rewrite ^/(.*) https://www.yblisgglib.online/$1 permanent;}server { listen 443 ssl; server_name www.yblisgglib.online; # ?????? access_log /var/log/nginx/example.com_access.log combined; error_log /var/log/nginx/example.com_error.log error; # ???? ssl_certificate /etc/nginx/cert/4296312_yblisgglib.online.pem; ssl_certificate_key /etc/nginx/cert/4296312_yblisgglib.online.key; # ?????? location /static { alias /home/login/static; } # ???? location / { include uwsgi_params; uwsgi_pass 127.0.0.1:8000; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }} [uwsgi]socket=127.0.0.1:8000chdir=/home/loginwsgi-file=/home/login/wsgi.pyhome=/env/venvprocesses=4threads=2master=Truepidfile=uwsgi.piddaemonize=uwsgi.logpython-autoreload=1
403 Forbidden?404 Not Found????????Nginx???????????????????
location /static { alias /home/login/static;}/home/login/static????????????
?????
sudo systemctl restart nginx
???????
#?????????????
mkdir -p /var/log/nginxchmod 755 /var/log/nginx
?????
uwsgi???
uwsgi????????????????127.0.0.1:8000????????????????????????????????????Nginx????????????
转载地址:http://pyjfk.baihongyu.com/