我在服务器上有一个 tomcat web 应用程序Ubuntu
。该 web 应用程序部署为ROOT
。我已安装apache2
并通过VirtualHost
我将 IP 直接指向 tomcat web 应用程序。因此我可以直接通过 IP(和域)访问该站点,例如125.20.20.50
或example.com
。
请检查下面的文件,它000-default.conf
是\etc\apache2\sites-enabled\
。
<VirtualHost *:80>
ProxyPreserveHost On
# Servers to proxy the connection, or;
# List of application servers:
# Usage:
# ProxyPass / http://[IP Addr.]:[port]/
# ProxyPassReverse / http://[IP Addr.]:[port]/
# Example:
ProxyPass / http://0.0.0.0:8080/
ProxyPassReverse / http://0.0.0.0:8080/
ServerName portal.example.com
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /opt/apache-tomcat-7.0.79/webapps/ROOT/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine On
# Set the path to SSL certificate
# Usage: SSLCertificateFile /path/to/cert.pem
SSLCertificateKeyFile /etc/apache2/ssl/xyz_key.key
SSLCertificateFile /etc/apache2/ssl/xyz_certificate.crt
SSLCertificateChainFile /etc/apache2/ssl/STAR_example_com.ca-bundle
ProxyPreserveHost On
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
ServerName portal.example.com
</VirtualHost>
证书没有问题,但运行时portal.example.com
出现503 Service Unavailable
错误。我在/var/log/apache2/error.log
文件中检查了这一点,错误如下。
[Fri Aug 04 07:33:22.185014 2017] [proxy:error] [pid 2056] (111)Connection refused: AH00957: HTTP: attempt to connect to 0.0.0.0:8080 (0.0.0.0) failed
[Fri Aug 04 07:33:22.185055 2017] [proxy:error] [pid 2056] AH00959: ap_proxy_connect_backend disabling worker for (0.0.0.0) for 60s
[Fri Aug 04 07:33:22.185059 2017] [proxy_http:error] [pid 2056] [client 113.59.205.35:49453] AH01114: HTTP: failed to make connection to backend: 0.0.0.0, referer: http://portal.example.com/
我在这里做错了什么?