I have set up the wiki software Gitit to run on two separate ports of the same Apache server (ports 1848 and 4000). I've confirmed that they are running:
http://wcaleb.rice.edu:4000
http://wcaleb.rice.edu:1848
Now I want to proxy these two sites to prettier URLs, like http://wiki.wcaleb.rice.edu and http://hist118.wcaleb.rice.edu. The IP address for both is 128.42.173.84
My server admin has added DNS entries for these names, but I can't seem to get my Apache configuration to work. Following the instructions here, I tried to set up a VirtualHost like this:
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>
And another similar virtual host for http://wiki.wcaleb.rice.edu on port 4000. But when I then issue service httpd restart
, I get a FAILED
message when starting httpd, and my browser can't connect to http://hist118.wcaleb.rice.edu.
As far as I know, the rest of my httpd.conf is the default file that comes with the distribution. My server is being run on a RedHat Enterprise machine. I'm a newbie to Apache, so I'm sure there's an obvious answer here, but after trying various tweaks to the config, I can't figure out what I'm doing wrong.
This is what you need to do.
Remove the
:1848
(or change it to:80
) on yourNameVirtualHost
andVirtualHost
. The whole point of this exercise is to have Apache listen on the default HTTP port (port 80) for these hostnames and proxy traffic to the high ports that Gitit is listening on.