黑科技

反向代理华为云OBS实现自定义域名访问

2019-06-12  本文已影响0人  w候人兮猗

前言

为什么?

如何做?

image image image
server
    {
        listen 443 ssl;
        server_name static.osdoc.cn;
        index index.php index.html index.htm default.php default.htm default.html;
        root /www;
        
        #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
        #HTTP_TO_HTTPS_START
        if ($server_port !~ 443){
            rewrite ^(/.*)$ https://$host$1 permanent;
        }
        #HTTP_TO_HTTPS_END
        ssl_certificate    /www/cert/fullchain.pem;
        ssl_certificate_key   /www/cert/private.key;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
        ssl_prefer_server_ciphers on;
        ssl_session_cache shared:SSL:10m;
        ssl_session_timeout 10m;
        #SSL-END
        
        location /{
            proxy_pass   http://osdoc-dev.obs.cn-north-4.*******.com;    #在这里设置一个代理,将对象存储访问域名设置在这
            add_header Cache-Control no-cache;
            add_header Pragma no-cache;
            add_header Expires 0;
        }
        
    
        access_log  /www/logs/static.osdoc.cn.log;
        error_log  /www/logs/static.osdoc.cn.error.log;
    }
image

缺点与总结

上一篇下一篇

猜你喜欢

热点阅读