Centos

在 CentOS 7 上代理 Apache 到 Payara

  • September 20, 2018

我有一個 apache 實例和一個 payara 伺服器,在“:8080/app-name”上部署了一個應用程序。我正在嘗試將網站的根代理到此埠和應用程序。我的配置如下:

httpd.conf

<VirtualHost *:80> 
 LoadModule proxy_module modules/mod_proxy.so
 LoadModule proxy_http_module modules/mod_proxy_http.so
 ProxyPreserveHost Off
 ProxyRequests Off
 SSLProxyEngine On
 ServerName example.com
 ServerAlias www.example.com
 ProxyPass / http://localhost:8080/app-name
 ProxyPassReverse / http://localhost:8080/app-name
</VirtualHost> 

問題是當我嘗試去時,example.com我被重定向到example.com//並且沒有顯示任何內容。

任何想法如何解決這一問題 ?

由於您沒有包含任何日誌,我只能猜測並給您一些指示。請使用 Apache 錯誤日誌中的詳細資訊更新您的問題。

# TLS VHost on Port 80? - move to 443.
# Needs
## Listen *:443 https
# as well.
<VirtualHost *:80>
 # Move LoadModule directives away from VHost configs.
 LoadModule proxy_module modules/mod_proxy.so
 LoadModule proxy_http_module modules/mod_proxy_http.so
 ProxyPreserveHost Off
 ProxyRequests Off
 # TLS VHosts need TLS directives too - they're missing
 SSLProxyEngine On 
 ServerName site-name.com
 ServerAlias www.site-name.com
 # Use trailing slashes on downstream host URLs
 ProxyPass / http://localhost:8080/app-name/
 ProxyPassReverse / http://localhost:8080/app-name/
</VirtualHost>

查看如何正確配置 TLS 的文件:https : //httpd.apache.org/docs/2.4/en/ssl/ssl_howto.html,https: //bettercrypto.org/static/applied-crypto-hardening.pdf .

添加權限以允許訪問:

<Proxy http://localhost:8080/app-name/>
 Require all granted
</Proxy>

調整 SELinux:

setsebool -P httpd_can_network_relay=1

引用自:https://serverfault.com/questions/931879