侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

关于域名重定向总结 https

2023-11-17 星期五 / 0 评论 / 0 点赞 / 87 阅读 / 3864 字

一:http域名的写法 在vhosts建一个不带www的.conf文件和一个带www的.conf文件 [root@iZ94oaf8ircZ vhosts]# cat test.net.conf ser

一:http域名的写法

在vhosts建一个不带www的.conf文件和一个带www的.conf文件

[root@iZ94oaf8ircZ vhosts]# cat test.net.conf 
server {

        listen 80;
        server_name  www.test.net;
        location / {
                proxy_redirect off;
                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://XXX.XXX.XXX.XXX:80XX;
        }
}
[root@iZ94oaf8ircZ vhosts]# cat www.test.net.conf 
server {
        listen 80;
        server_name test.net;
        location / {
                rewrite ^/(.*) http://www.test.net/$1 permanent;
         }
    }

二:https域名的写法

在vhosts建一个不带www的.conf文件和一个带www的.conf文件

[root@iZ94oaf8ircZ vhosts]# cat test.net.conf 

server {
    listen 80;
    server_name www.test.net;
    return 301 https://$server_name$request_uri;

}

server {

    listen 443  ssl ;
    server_name  www.test.net;
    root html;
    index index.html index.htm;
    ssl_certificate   cert/214069022810266.pem;              
    ssl_certificate_key  cert/214069022810266.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;

        location /resources {
            root  /home/test;
            index  index.html 50x.html;
        }

        location / {
                proxy_redirect off;
                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://127.0.0.1:8071;
        }

        #location /job {
        #        proxy_pass  http://127.0.0.1:8071/job ;
        #}

        location /manage {
                proxy_pass  http://127.0.0.1:8072/manage ;
        }
}

[root@iZ94oaf8ircZ vhosts]# cat www.test.net.conf 
server {
        listen 80;
        server_name test.net;
        location / {
                rewrite ^/(.*) http://www.test.net/$1 permanent;
         }
    }

广告 广告

评论区