Apache Setup to Redirect a Site

While I was developing a dancer application, I usually open a new port, like goople.com:4001. Actually there is a better way to do this.

On our CentOS server, in the httpd.conf file, we include the following piece to it:

1
Include etc/apache22/Includes/*.conf

If it is not already there.

Then in the dir, /usr/local/etc/apache22/Includes, we will write our own configuration file.

Then we can make a file named sun.conf in the Includes dir and write to it something like this:

1
2
3
4
5
6
7
8
Alias /~stsun /home/stsun/public_html

<Directory "/home/stsun/public_html">
	Options +Indexes FollowSymLinks
	AllowOverride All
	Order allow,deny
	Allow from all
</Directory>

Of course we have another way for this:

1
2
3
4
5
6
7
8
9
10
11
12
13
NameVirtualHost *:8080
<VirtualHost *:8080>
    DocumentRoot "/Users/sun/w"
    <Directory "/Users/sun/w">
        DirectoryIndex index.html
        AddHandler cgi-script .py .pl
        AddType text/html .py .html .pl
        Options ExecCGI
        Order Allow,Deny
        AllowOverride All
        Allow from all
    </Directory>
</VirtualHost>