php C Nginx:使用fastcgi_pass时覆盖主机头
发布时间:2023-12-17 23:57:17 所属栏目:Nginx 来源:DaWei
导读: 我正在尝试覆盖使用fastcgi_pass时传递给基于php的应用程序(特别是Phabricator)的http主机头.
我在使用proxy_pass时发现了很多这样做的例子,但我似乎无法找到如何使用fastcgi_pass执行此操
我在使用proxy_pass时发现了很多这样做的例子,但我似乎无法找到如何使用fastcgi_pass执行此操
我正在尝试覆盖使用fastcgi_pass时传递给基于php的应用程序(特别是Phabricator)的http主机头. (这样做的原因是我想将几个不同的域与Phabricator webapp相关联,但它只允许一个域关联,它拒绝任何没有那个域的请求.) 我很擅长用FastCGI配置Nginx,所以我不确定fastcgi的工作原理.任何帮助表示赞赏. 这是我的Nginx服务器配置: server { server_name phabricator.localhost www.example.com example.com; root /opt/phabricator/phabricator/webroot; location / { index index.php; rewrite ^/(.*)$/index.php?__path__=/$1 last; } location = /favicon.ico { try_files $uri =204; } location /index.php { fastcgi_pass localhost:9000; fastcgi_index index.php; #### HERE ARE MY ATTEMPTS ##### #proxy_set_header HOST phabricator.localhost; #fastcgi_param SERVER_NAME phabricator.localhost; #fastcgi_pass_header 'Host: phabricator.localhost'; #fastcgi_pass_header 'Host: phabricator.localhost'; #add_header Host phabricator.localhost; #proxy_set_header Host phabricator.localhost; #### END ATTEMPTS #### fastcgi_param REDIRECT_STATUS 200; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; fastcgi_param REMOTE_ADDR $remote_addr; } } 最佳答案 你试过HTTP_HOST吗?以下为我工作: fastcgi_param HTTP_HOST phabricator.localhost;(编辑:哈尔滨站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 无法从Java中的Nginx反向代理获取远程IP
- 在nginx上重写一个子目录到root
- nginx将文件类型传递给后端服务器
- php – CodeIgniter的Nginx重写规则
- 使用mod_wsgi冻结Django / Apache
- 调试Nginx缓存未命中:尽管代理有效,但仍会遇到大量的MISS
- 配置 – Nginx:指定访问日志位置时我可以使用$server_name
- NGinx将websocket从80扩展到websocket端口
- django-Nginx:在CentOS 7上对Gunicorn套接字的权限被拒绝
- centos C 为Phusion Passenger 3提供SSL支持的Curl开发标题
推荐文章
站长推荐