首页 > 其他 > 详细

nginx配置多个静态资源

时间:2019-09-22 14:56:16      阅读:473      评论:0      收藏:0      [点我收藏+]

 

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;
        }
    }

技术分享图片

 

nginx配置多个静态资源

原文:https://www.cnblogs.com/aqicheng/p/11567161.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!