我想在我的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.
答案 0 :(得分: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