标签:microsoft real-ip rlock perm www. nginx 提高 了解 focus
===============================================
2019/3/31_第1次修改 ccb_warlock
===============================================
搜索引擎SEO优化是指通过一些手段,提高网站的权重(排名)。
前提:
1. 以www.abc.cn为例;
2. 以nginx作为反代服务器;
3. 反代目标地址:192.168.1.1;
server { listen 80; server_name www.abc.cn abc.cn; access_log off; error_log off; # 其他解析省略 location / { rewrite ^(.*)$ https://$host$1 permanent; } } server { listen 443 ssl; server_name www.abc.cn abc.cn; access_log off; error_log off; # ssl配置省略 # 其他解析省略 location / { proxy_pass http://192.168.1.1; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_http_version 1.1; } }
思路:将abc.cn的解析单独拿出来。
假设:
server { listen 80; server_name www.abc.cn; access_log off; error_log off; # 其他解析省略 location / { rewrite ^(.*)$ https://$host$1 permanent; } } server { listen 443 ssl; server_name www.abc.cn; access_log off; error_log off; # ssl配置省略 # 其他解析省略 location / { proxy_pass http://192.168.1.1; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_http_version 1.1; } } server { listen 80; server_name abc.cn; access_log off; error_log off; location / { rewrite ^/(.*) http://www.abc.cn$request_uri? permanent; } } server { listen 443 ssl; server_name abc.cn; access_log off; error_log off; # ssl配置省略 location / { rewrite ^/(.*) https://www.abc.cn$request_uri? permanent; } }
标签:microsoft real-ip rlock perm www. nginx 提高 了解 focus
原文地址:https://www.cnblogs.com/straycats/p/10634047.html