目的:反向代理后,不影响 SSL 证书验证过程。(面板:托塔李天王的粉丝法海的宝塔) test3.baidu.com 为用户访问的域名 m.google.com 为被反代的域名
试过在反向代理规则的前面设置规则,但是无效
/www/wwwroot/test3.baidu.com/.well-known 为网站目录下的 let's encrypt 证书验证文件存放文件夹
server
{
listen 80;
server_name test3.baidu.com;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/test3.baidu.com;
#SSL-START SSL 相关配置,请勿删除或修改下一行带注释的 404 规则
#error_page 404/404.html;
#SSL-END
#ERROR-PAGE-START 错误页配置,可以注释、删除或修改
error_page 404 /404.html;
error_page 502 /502.html;
#ERROR-PAGE-END
#PHP-INFO-START PHP 引用配置,可以注释或修改
#试过 location /.well-known 加转义符也不行 location /\.well-known 不知道如何是好。
location /.well-known {
root /www/wwwroot/test3.baidu.com/.well-known;
}
#PROXY-START
location /
{
proxy_pass http://m.google.com;
proxy_set_header Host m.google.com;
proxy_set_header X-Forwarded-For $remote_addr;
#proxy_cache cache_one;
#proxy_cache_key m.google.com$request_uri$is_args$args;
#proxy_cache_valid 200 304 301 302 1h;
add_header X-Cache $upstream_cache_status;
proxy_set_header Accept-Encoding "";
sub_filter "m.google.com" "test3.baidu.com";
sub_filter_once off;
expires 12h;
add_header Content-Security-Policy "script-src 'self' 'unsafe-inline'";
}
location ~ .*\.(php|jsp|cgi|asp|aspx|flv|swf|xml)?$
{
proxy_set_header Host m.google.com;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://m.google.com;
proxy_set_header Accept-Encoding "";
sub_filter "m.google.com" "test3.baidu.com";
sub_filter_once off;
add_header Content-Security-Policy "script-src 'self' 'unsafe-inline'";
}
#PROXY-END
include enable-php-71.conf;
#PHP-INFO-END
#REWRITE-START URL 重写规则引用,修改后将导致面板设置的伪静态规则失效
include /www/server/panel/vhost/rewrite/test3.baidu.com.conf;
#REWRITE-END
access_log /www/wwwlogs/test3.baidu.com.log;
}
1
Nioty 2017-12-09 12:56:22 +08:00 via Android
注意下格式 这样的没法看
|
3
msg7086 2017-12-10 13:24:03 +08:00
你试过 location /.well-known {} 吗?
|
4
nfroot OP @msg7086 我只试过这 2 个方式
location /.well-known { root /www/wwwroot/test3.baidu.com/.well-known; } location /\.well-known { root /www/wwwroot/test3.baidu.com/.well-known; } |
6
msg7086 2017-12-11 00:22:43 +08:00
你 root /www/wwwroot/test3.baidu.com/.well-known 的话,访问 /.well-known 不就变成 /.well-known/.well-known 了吗。
|