php C Nginx:使用fastcgi_pass时覆盖主机头
发布时间:2023-12-19 20:54:22 所属栏目: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;(编辑:甘南站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- node.js – 如何从作为nodejs服务器的反向代理的nginx服务器
- django – 使用proxy_pass的nginx位置路径
- NGinx域名重定向
- apache-2.2 – Jetty应该总是落后于另一个网络服务器(例如n
- Nginx反向代理到另一个提供静态文件的Nginx服务器
- ruby-on-rails-capistrano部署后ec2服务器中缺少puma.sock
- django -supervisorctl总是报告错误:ERROR(没有此类文件)
- 如何在SSL终端负载均衡器后面设置nginx以重定向到某个主机的
- 与环境无关的301/302重定向与PHP
- Django应用程序在运行服务器下运行,但在nginx下运行404
推荐文章
站长推荐
- Nginx或LVS for Node.js负载平衡?
- 如何允许特定IP到Nginx中的URL(而不是目录!)
- nginx – 将php更新为5.5后得到502坏网关
- 插件 – 我的nginx模块可以在主进程中建立连接吗
- ruby-on-rails C 使用Rails和Nginx获取客户端的真
- python – X-Forwarded-Proto和Flask
- 在nginx上重定向57,000个URL的最佳方法是什么?
- ruby-on-rails – 使用SSL在Nginx后面的Rails 5中
- nginx – 如何部署我的Angular 2 Typescript Web
- Nginx try_files(文件夹文件)后备