反向代理 Tomcat Apache 背后的 Web 应用程序
Reverse Proxying Tomcat Web Applications Behind Apache
我想在我的 Ubuntu 14.04 LTS 配置文件中为我的虚拟主机创建一个配置,所以我修改了文件 /etc/apache2/sites-available/mysite.com.conf 如下:
# domain: mysite.com
# public: /var/www/mysite.com/public_html/
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin webmaster@mysite.com
ServerName www.mysite.com
ServerAlias mysite.com
ProxyPass / http://139.333.222.107:8080/devices
ProxyPassReverse / http://139.333.222.107:8080/devices
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /var/www/mysite.com/public_html
# Log file locations
LogLevel warn
ErrorLog /var/www/mysite.com/log/error.log
CustomLog /var/www/mysite.com/log/access.log combined
</VirtualHost>
但是当我 运行 sudo service apache2 restart
时,我得到了这个错误:
* Restarting web server apache2 [fail]
* The apache2 configtest failed.
Output of config test was:
AH00526: Syntax error on line 9 of /etc/apache2/sites-enabled/mysite.com.conf:
Invalid command 'ProxyPass', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
您不包括 mod_proxy。取决于您的安装(抱歉不熟悉 Ubuntu),但这通常意味着以下行将在您的主 httpd.conf 文件中:
#LoadModule proxy_module modules/modproxy.so
删除 # 以使其停止被注释掉并加载并重新启动 Apache。
这个link也可能有帮助:https://askubuntu.com/questions/341684/how-to-load-the-modules-for-apache2
我想在我的 Ubuntu 14.04 LTS 配置文件中为我的虚拟主机创建一个配置,所以我修改了文件 /etc/apache2/sites-available/mysite.com.conf 如下:
# domain: mysite.com
# public: /var/www/mysite.com/public_html/
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin webmaster@mysite.com
ServerName www.mysite.com
ServerAlias mysite.com
ProxyPass / http://139.333.222.107:8080/devices
ProxyPassReverse / http://139.333.222.107:8080/devices
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /var/www/mysite.com/public_html
# Log file locations
LogLevel warn
ErrorLog /var/www/mysite.com/log/error.log
CustomLog /var/www/mysite.com/log/access.log combined
</VirtualHost>
但是当我 运行 sudo service apache2 restart
时,我得到了这个错误:
* Restarting web server apache2 [fail]
* The apache2 configtest failed.
Output of config test was:
AH00526: Syntax error on line 9 of /etc/apache2/sites-enabled/mysite.com.conf:
Invalid command 'ProxyPass', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
您不包括 mod_proxy。取决于您的安装(抱歉不熟悉 Ubuntu),但这通常意味着以下行将在您的主 httpd.conf 文件中:
#LoadModule proxy_module modules/modproxy.so
删除 # 以使其停止被注释掉并加载并重新启动 Apache。
这个link也可能有帮助:https://askubuntu.com/questions/341684/how-to-load-the-modules-for-apache2