Skip to content
本文总阅读量

nginx

  • 负载均衡 upstream
  • 域名配置
  • 443 https配置

命令

  • 检查:nginx -t
  • 重启:nginx -s reload
#upstream qysocket {
#    server    127.0.0.1:8848 weight=2;
#    server    127.0.0.1:8849 weight=1;
#}
server {
       listen 80;
       server_name 域名;
       rewrite ^(.*)$ https://${server_name}$1 permanent;
}
server {
        # https
       listen 443 ssl;
       server_name 域名;
       # 证书    
       ssl_certificate      /etc/nginx/ssh/ibangche.com/1_ibangche.com_bundle.crt;
       ssl_certificate_key  /etc/nginx/ssh/ibangche.com/2_ibangche.com.key;


       ssl_session_timeout  5m;
       client_max_body_size 10m;


       location / {
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";    # socket配置
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $host;
            proxy_pass  http://qysocket;
	        proxy_pass http://127.0.0.1:8848;
       }
}