码迷,mamicode.com
首页 > 其他好文 > 详细

nginx配置多个静态资源

时间:2019-09-22 15:28:53      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:red   lin   man   静态   jpeg   png   include   permanent   index   

 

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配置多个静态资源

标签:red   lin   man   静态   jpeg   png   include   permanent   index   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!