nginx https配置+nginx跳转到万网虚拟主机

server {
    listen      443 ssl;
    server_name  www.104dh.com 104dh.com;
    ssl on;
    ssl_certificate   cert104/1526781357484.pem;
    ssl_certificate_key  cert104/1526781357484.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;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    location / {
          proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

            proxy_pass  http://web.104dh.com;
            index  index.html index.htm;
        }
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
           proxy_pass  http://web.104dh.com;
        }
    
        location ~ .*\.(js|css)?$
        {
            proxy_pass  http://web.104dh.com;
        }
    
    
}
server {
listen 80;
server_name  www.104dh.com 104dh.com;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#rewrite ^(.*) https://$server_name$1 permanent;
rewrite ^(.*)$  https://$host$1 permanent;

}

 

posted @ 2018-06-28 09:16  不断努力的青春  阅读(451)  评论(0编辑  收藏  举报