我在Ubuntu服务器中有一个tomcat web应用程序。 Web应用程序被部署为ROOT 。 我已经安装了apache2并通过一个VirtualHost我指出的IP直接到tomcat的Web应用程序。 所以我可以直接通过IP(和域)访问网站,比如125.20.20.50或example.com 。
请检查以下文件,该文件是\etc\apache2\sites-enabled\的000-default.conf 。
<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/
我在这里做错了什么?