跳至主要內容

Nginx

LiCheng小于 1 分钟

Nginx

  • 2019

配置😎

#user  nobody;
worker_processes  1;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    
    #负载均衡ly最后不要有空格
    upstream ly{ 
        server localhost:8080;
        server localhost:8081;
    }
    server {
        listen 443 ssl;
        server_name www.shileke.cn;
        root html;
        index index.html index.htm;
        ssl_certificate   /usr/local/nginx/cert/3022254_www.shileke.cn.pem;
        ssl_certificate_key  /usr/local/nginx/cert/3022254_www.shileke.cn.key;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
        #强制https访问
        #fastcgi_param   HTTPS         on;
        #fastcgi_param   HTTP_SCHEME   https;	
    
        location / {
                    root  /usr/local/src/static/dengling/;
                    index index.html index.htm;
               }
    
        location /api {    
            charset utf-8;          #显示中文
            proxy_pass http://ly/;
            proxy_redirect off;	  
        }
    
        location /app {
            alias /usr/local/src/app/;
            autoindex on;
        }
    }
}