nginx配置多个静态资源

server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  backtest.chuanyuexizang.com;
        root         /usr/share/nginx/html;

        rewrite ^(.*) https://$host$1 permanent;# HTTP强转HTTPS
        include /etc/nginx/default.d/*.conf;

        error_page 404 /404.html;
            location = /40x.html {
        }
        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
    server {
        listen 443 ssl;
        server_name backtest.chuanyuexizang.com;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

        ssl_certificate ssl/1_backtest.chuanyuexizang.com_bundle.crt; # 公钥目录
        ssl_certificate_key ssl/2_backtest.chuanyuexizang.com.key; # 私钥目录

        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;
        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;

        location /www1{
                alias /usr/share/nginx/html;
                index index.html index.php index.htm;
        }
        location /www2{
                alias /usr/share/nginx/dist;
                index index.html index.php index.htm;
         }
        location  ~ .*\.(jpg|jpeg|gif|png|ico|css|js|pdf|txt)$ {
                root /usr/share/nginx/;
                proxy_temp_path /usr/share/nginx/;
        }

         location /admin {
               proxy_pass http://127.0.0.1:9019/;
               proxy_set_header Host $host:$server_port;
        }
    }

猜你喜欢

转载自www.cnblogs.com/aqicheng/p/11567161.html