# 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 /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/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; 没文件导入干嘛
server {
listen 80;
server_name www.yblisgglib.online;
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;
}
}
# Settings for a TLS enabled server.
#
# server {
# listen 443 ssl http2 default_server;
# listen [::]:443 ssl http2 default_server;
# server_name _;
# root /usr/share/nginx/html;
#
# ssl_certificate "/etc/pki/nginx/server.crt";
# ssl_certificate_key "/etc/pki/nginx/private/server.key";
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 10m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
#
# # Load configuration files for the default server block.
# include /etc/nginx/default.d/*.conf;
#
# location / {
# }
#
# error_page 404 /404.html;
# location = /40x.html {
# }
#
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }
# }
}
/etc/nginx文件夹下
还由uwsgi.ini 配置
#添加配置选择
[uwsgi]
#配置和nginx连接的socket连接
socket=127.0.0.1:8000
#配置项目路径,项目的所在目录
chdir=/home/login
#配置wsgi接口模块文件路径
wsgi-file=login/wsgi.py
#配置虚拟文件的路径
#home=/env/venv
#配置启动的进程数
processes=4
#配置每个进程的线程数
threads=2
#配置启动管理主进程
master=True
#配置存放主进程的进程号文件
pidfile=uwsgi.pid
#配置dump日志记录
daemonize=uwsgi.log
#配置热加载
py-autoreload=1
一直报错找不到static,调试了半天,找到成功的那里,原因在于,nginx的static设置要求设置static并且配置里也是static
# 指定静态文件路径 location /static { alias /home/datav2/static; #index index.html index.htm; }
/home/datav2/static是最终的根目录了。