2016-01-23 85 views
0

我想在我的Ubuntu 14.04 LTS配置文件中爲我的虛擬主機創建配置,因此我修改了文件/etc/apache2/sites-available/mysite.com.conf,如下所示:反向代理Apache Tomcat Web應用程序

# domain: mysite.com 
# public: /var/www/mysite.com/public_html/ 

<VirtualHost *:80> 
    # Admin email, Server Name (domain name), and any aliases 
    ServerAdmin [email protected] 
    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. 

回答

0

您還沒有包括mod_proxy的。取決於你的安裝(抱歉不熟悉Ubuntu的),但通常這意味着下面一行將在主httpd.conf文件:

#LoadModule proxy_module modules/modproxy.so 

刪除#,因此停止被註釋掉和被加載並重新啓動Apache 。

此鏈接可能也有幫助:https://askubuntu.com/questions/341684/how-to-load-the-modules-for-apache2