Nginx配置

更新于 2024-07-24

手动配置fastcgi

location /
{
    try_files $uri $uri/index.html $uri.html @fcgi_passby;
}
location @fcgi_passby {
    fastcgi_pass   127.0.0.1:1082;
    fastcgi_pass_request_headers on; 
    include        fastcgi.conf;
}

querystring map ##

map '?$query_string' $qs {
  '?' '';
  default '?$query_string';
}

接受自定义头

underscores_in_headers on;

允许穿透到客户端的代理响应头

proxy_pass_header Server;

基本反代

#全部请求都反代到目标
location ~ ^/
{
  proxy_http_version 1.1;
  proxy_set_header X-Forwarded-For $remote_addr;
  proxy_set_header X-Real-Ip $remote_addr;
  proxy_set_header Front-End-Https on;
  proxy_set_header Host $http_host;
  proxy_pass_header Server;
  proxy_pass http://127.0.0.1:9445;
}