yelmos

test

nginx uwsgi 文件配置示例

user root;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;
proxy_connect_timeout 120;
proxy_read_timeout 120;
#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 logs/access.log main;

sendfile on;
#tcp_nopush on;

# keepalive_timeout 0;
keepalive_timeout 1000;
upstream meiduo {
server 192.168.27.77:8001; # 此处为uwsgi运行的ip地址和端口号
# 如果有多台服务器,可以在此处继续添加服务器地址
}

#gzip on;
server {
listen 8000;
server_name api.meiduo.site;

location / {
include uwsgi_params;
uwsgi_pass meiduo;
}
}
# 以下是静态业务逻辑
server {
listen 80;
server_name www.meiduo.site;

#charset koi8-r;

#access_log logs/host.access.log main;
location /xadmin {
include uwsgi_params;
uwsgi_pass meiduo;
}

location /ckeditor {
include uwsgi_params;
uwsgi_pass meiduo;
}

location / {
root /home/python/Desktop/front_end_pc;
index index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

# location / {
# root html;
# index index.html index.htm;
# }
#}


# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;

# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}

}

 

 

 

[uwsgi]
#使用nginx连接时使用,Django程序所在服务器地址
socket=127.0.0.1:9000
#直接做web服务器使用,Django程序所在服务器地址
; http=192.168.199.133:8001
#项目目录
chdir=/home/yelmos/drawio/darwin-django/zhijiangleinao
#项目中wsgi.py文件的目录,相对于项目目录
wsgi-file=zhijiangleinao/wsgi.py
# 进程数
processes=4
# 线程数
threads=2
# uwsgi服务器的角色
master=True
# 存放进程编号的文件
pidfile=uwsgi.pid
# 日志文件,因为uwsgi可以脱离终端在后台运行,日志看不见。我们以前的runserver是依赖终端的
daemonize=uwsgi.log
# 指定依赖的虚拟环境
virtualenv=/root/.virtualenvs/drawiotest

 

posted on 2021-09-22 20:02  yelmos  阅读(193)  评论(0编辑  收藏  举报

导航