对Nginx的Apache ReverseProxy只显示Nginx的默认localhost域

我正在CentOS Nginx上configurationApache ReverseProxy上的Tuleap。

Tuleap在CentOS上成功运行,可以访问。

configuration完反向代理后,我已经使用glassfish和另一个相同的configurationApache服务器工作正常。 但是nginx只显示localhost页面。

查看nginx tuleap主机和apache reverseproxy主机的configuration文件

nginxconfiguration:

# For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; # Load dynamic modules. See /usr/share/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; # Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. include /etc/nginx/conf.d/*.conf; } 

nginx上的tuleap主机:

 upstream tuleap { server 127.0.0.1:8080; } server { listen 443 ssl; server_name tuleap.cent.example.com; ssl_certificate /etc/pki/tls/certs/localhost.crt; ssl_certificate_key /etc/pki/tls/private/localhost.key; ssl_session_timeout 1d; ssl_session_cache shared:SSL:50m; ssl_session_tickets off; # intermediate configuration. tweak to your needs. ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ''; ssl_prefer_server_ciphers on; # Tweak for file upload and SVN client_max_body_size 64M; include conf.d/tuleap.d/*.conf; # Available here in case of emergency, uncomment the # line below (and comment the line above) #include conf.d/tuleap-apache.proxy; } server { listen 80; server_name tuleap.cent.example.com; # Tweak for file upload and SVN client_max_body_size 64M; include conf.d/tuleap.d/*.conf; } 

apache reverseproxy conf:

 <VirtualHost *:443> ServerName bugs.example.org SSLEngine On SSLCertificateFile "/etc/letsencrypt/live/bugs.example.org/fullchain.pem" SSLCertificateKeyFile "/etc/letsencrypt/live/bugs.example.org/privkey.pem" ProxyRequests Off ProxyPreserveHost On AllowEncodedSlashes NoDecode ProxyPass / http://tuleap.cent.example.com/ nocanon ProxyPassReverse / http://tuleap.cent.example.com/ ProxyPassReverse / http://bugs.example.org/ <Proxy *> Order deny,allow Allow from all Require all granted </Proxy> <Location /> Order allow,deny Allow from all Require all granted </Location> </VirtualHost> 

请让我知道是否有任何需要更新nginxconfiguration文件。

尝试添加

 proxy_set_header Host $http_host; 

会发生什么事情是,当代理您的请求时,它使用http://127.0.0.1:8080/地址,而不设置正确的主机头,这是照顾在Apache

 ProxyPreserveHost On