nginxsudo yum install nginx
pipsudo yum install python-pip
uWsgisudo pip uwsgi
# test.pydef
application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return "Hello World"
uwsgi --http :8001 --wsgi-file test.py
"""
WSGI config for WHPAIWechat project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import osfrom django.core.wsgi import
get_wsgi_applicationos.environ.setdefault("DJANGO_SETTINGS_MODULE", "WHPAIWechat.settings")
application = get_wsgi_application()
upstream django {
server 127.0.0.1:8000; # 注意8000是上述uwsgi监听的端口
}
server {
listen 80 default_server;
server_name _;
#charset koi8-r;
#access_log logs/host.access.log main;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location = /404.html {
root /usr/share/nginx/html;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ .html$ {
root /usr/share/nginx/html/front;
index index.html index.htm;
}
location ~ .(png|jpg|jpeg|css|img|js|flv|swf|download|eot|svg|ttf|woff|woff2|otf)$ {
root /usr/share/nginx/html/front;
}
# 以上都不匹配的的访问分发到uwsgi上
location / {
include /etc/nginx/uwsgi_params; #详细看下文
uwsgi_pass django;
}
* # PHP分到 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;
#}*
}
uwsgi_param QUERY_STRING $query_string; uwsgi_param REQUEST_METHOD $request_method; uwsgi_param CONTENT_TYPE $content_type; uwsgi_param CONTENT_LENGTH $content_length; uwsgi_param REQUEST_URI $request_uri; uwsgi_param PATH_INFO $document_uri; uwsgi_param DOCUMENT_ROOT $document_root; uwsgi_param SERVER_PROTOCOL $server_protocol; uwsgi_param REMOTE_ADDR $remote_addr; uwsgi_param REMOTE_PORT $remote_port; uwsgi_param SERVER_PORT $server_port; uwsgi_param SERVER_NAME $server_name;
sudo service nginx restart
sudo service nginx reload
#WHPAIWechat_uwsgi.ini[uwsgi] socket = 127.0.0.1:8000 chdir = /home/jiayandev/WHPAIWechat/ wsgi-file = WHPAIWechat/wsgi.py processes = 4 threads = 2 master=True #设置此参数,有一个主进程 pidfile= pidfile/project-master.pid #主进程id写入文件里 vacuum=True #退出时,清理环境 daemonize = uwsgi.log #守护进程的方式运行,log日志存在此log文件里
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有