想要实现的功能就是域名目录反代一个 typecho 站点。
例如:https://domain.com/tt/ 反代至本地的 http://127.0.0.1:5622
架构是 LNMP 一键安装包安装的 nginx 和 mysql, php,目前已经有一个 typecho 站点正常运行中。
尝试过几种写法,要么 404 ,要么 url header 会是 127.0.0.1:5622
希望 v 友 能指教一下,感谢。。。
~~想这么做的原因主要是这样就不用申请 ssl 证书了(~~
location /tt/ {
proxy_method GET;
proxy_pass_request_headers on;
proxy_pass_request_body 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;
proxy_pass http://127.0.0.1:5622;
}
server {
listen 5622;
server_name 127.0.0.1;
include enable-php-pathinfo.conf;
location / {
root /home/wwwroot/typecho/;
index index.php,index.html;
# if (-f $request_filename/index.html) {
# rewrite (.*) $1/index.html break;
# }
# if (-f $request_filename/index.php) {
# rewrite (.*) $1/index.php;
# }
# if (!-f $request_filename)
# {
# rewrite (.*) /index.php; }
}