Cal*_*iel 5 linux apache virtualhost
我已经将wiki软件Gitit设置为在同一个Apache服务器的两个独立端口上运行(端口1848和4000).我已经确认他们正在运行:
http://wcaleb.rice.edu:4000
http://wcaleb.rice.edu:1848
现在我想将这两个网站代理为更漂亮的网址,例如http://wiki.wcaleb.rice.edu和http://hist118.wcaleb.rice.edu.两者的IP地址是128.42.173.84
我的服务器管理员为这些名称添加了DNS条目,但我似乎无法使我的Apache配置工作.按照这里的说明,我尝试设置如下的VirtualHost:
NameVirtualHost *:1848
<VirtualHost *:1848>
ServerName hist118.wcaleb.rice.edu
DocumentRoot /var/www/
RewriteEngine On
ProxyPreserveHost On
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPassReverse / http://127.0.0.1:1848
RewriteRule ^(.*) http://127.0.0.1:1848$1 [P]
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
另一个类似于端口4000上的http://wiki.wcaleb.rice.edu的虚拟主机.但是当我发出时service httpd restart,我FAILED在启动httpd时收到一条消息,而我的浏览器无法连接到http://hist118.wcaleb .rice.edu.
据我所知,我的httpd.conf的其余部分是发行版附带的默认文件.我的服务器正在RedHat Enterprise机器上运行.我是Apache的新手,所以我确定这里有一个明显的答案,但在对配置进行各种调整后,我无法弄清楚我做错了什么.
这就是你需要做的。
NameVirtualHost *:80
<VirtualHost *:80>
ServerName hist118.wcaleb.rice.edu
DocumentRoot /var/www/
RewriteEngine On
ProxyPreserveHost On
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPassReverse / http://127.0.0.1:1848
RewriteRule ^(.*) http://127.0.0.1:1848$1 [P]
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
515 次 |
| 最近记录: |