介绍
sxf 电脑禁用了某些网址怎么办?下面介绍点歪货,看懂了就看懂了,看不懂加强学习
需要准备知识点(门槛): nginx 反向代理;会用window电脑百度,会修改电脑host ,会用电脑生成ssl
思路
这里就说一些大白话: nginx + 修改本地host
少废话上nginx配置
- nginx 代理代码块
location /
{
expires 12h;
if ($request_uri ~* "(php|jsp|cgi|asp|aspx)")
{
expires 0;
}
proxy_pass https://220.181.111.91;
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_set_header REMOTE-HOST $remote_addr;
add_header X-Cache $upstream_cache_status;
proxy_set_header Accept-Encoding "";
sub_filter_once off;
proxy_cache cache_one;
proxy_cache_key $host$uri$is_args$args;
proxy_cache_valid 200 304 301 302 12h;
}
-
修改host, 添加如下配置(简单的知识点)
127.0.0.1 pan.baidu.com -
启用nginx 80服务器
光启用是没用的,需要https访问才行,所以你需要配置nginx 通过pan.baidu.com进来时候可以ssl访问
贴点示例
server
{
listen 80;
listen 443 ssl;
server_name pan.baidu.com;
index index.php index.html index.htm default.php default.htm default.html;
root D:/wwwroot/pan.baidu.com;
#START-ERROR-PAGE
#error_page 403 /403.html;
error_page 404 /404.html;
#error_page 502 /502.html;
#END-ERROR-PAGE
#HTTP_TO_HTTPS_START
#HTTP_TO_HTTPS_END
#LIMIT_INFO_START
#LIMIT_INFO_END
#SSL-INFO-START
ssl_certificate ssl/pan.baidu.com/fullchain.pem;
ssl_certificate_key ssl/pan.baidu.com/privkey.pem;
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;
error_page 497 https://$host$request_uri;
#SSL-INFO-END
#反代清理缓存配置
location ~ /purge(/.*) {
proxy_cache_purge cache_one $1$is_args$args;
}
#proxy 反向代理
include proxy/pan.baidu.com/*.conf;
#PHP-INFO-START
include php/00.conf;
#PHP-INFO-END
#REWRITE-START
include rewrite/pan.baidu.com/*.conf;
#REWRITE-END
#redirect 重定向
include redirect/pan.baidu.com/*.conf;
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
#一键申请SSL证书验证目录相关设置
location ~ \.well-known{
allow all;
}
access_log D:/BtSoft/wwwlogs/pan.baidu.com.log;
error_log D:/BtSoft/wwwlogs/pan.baidu.com.error.log;
}
- 生成ssl
生产ssl 我不说,反正cmd直接完成,自己百度 - 把nginx启动了就行,
访问效果