电子灵魂

golang,go,C#,JAVA,PYTHON,PHP

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

uwsgi 配置文件

[uwsgi]
http-socket = 127.0.0.1:8080
# 项目目录
chdir=/home/ubuntu/mkweb
# 指定项目的application
module=mkweb.wsgi:application
# 进程个数
workers=5
pidfile=/home/ubuntu/mkweb/script/uwsgi.pid
# 指定IP端口
http=127.0.0.1:8081
# 指定静态文件
static-map=/static=/home/ubuntu/mkweb/static
# 启动uwsgi的用户名和用户组
uid=root
gid=root
# 启用主进程
master=true
# 自动移除unix Socket和pid文件当服务停止的时候
vacuum=true
# 序列化接受的内容,如果可能的话
thunder-lock=true
# 启用线程
enable-threads=true
# 设置自中断时间
harakiri=30
# 设置缓冲
post-buffering=4096
# 设置日志目录
daemonize=/home/ubuntu/mkweb/script/uwsgi.log
# 指定sock的文件路径
socket=/home/ubuntu/mkweb/script/uwsgi.sock



nginx.conf 配置文件

user www-data;
worker_processes auto;
pid /run/nginx.pid;

events {
	worker_connections 1024;
}
http {
		# 这2段是解决页面不解析css等文件
		include /etc/nginx/mime.types;
		default_type application/octet-stream;

# 负载均衡
upstream mkweb {
	server 127.0.0.1:8080;
	server 127.0.0.1:8081;
	}
	
server {
        listen 80;
	listen 443 ssl;
        # ssl on;
        ssl_certificate 1_arecn.com_bundle.crt;
        ssl_certificate_key 2_arecn.com.key;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
        ssl_prefer_server_ciphers on;
		
	# 强制跳转到SSL模式
	# return      301 https://$server_name$request_uri;
        # rewrite ^(.*) https://$host$1 permanent;
        if ($host ~* "^arecn.com$") {
        rewrite ^/(.*)$ https://www.arecn.com/ permanent;
        }

        server_name www.arecn.com arecn.com *.arecn.com;
        access_log  /home/ubuntu/nginx/access.log;
        error_log  /home/ubuntu/nginx/error.log;
        charset  utf-8; # Nginx编码
        gzip on;
        gzip_types text/plain application/x-javascript text/css text/javascript application/x-httpd-php application/json text/json image/jpeg image/gif image/png application/octet-stream;

        error_page  404           /404.html;
        error_page   500 502 503 504  /50x.html;

        location / {
            include uwsgi_params; # 核心配置
            uwsgi_connect_timeout 30;
	    uwsgi_param UWSGI_CHDIR /home/ubuntu/mkweb; # 核心配置
            uwsgi_pass unix:/home/ubuntu/mkweb/script/uwsgi.sock; # 核心配置
	    #uwsgi_pass mkweb; # 负载均衡
  
        }
		# 处理静态文件
        location /static/ {
            alias  /home/ubuntu/mkweb/static/;
            index  index.html index.htm;
        }
}
}
posted on 2018-11-08 11:14  conncent  阅读(520)  评论(0编辑  收藏  举报