1
votes

I'm using apache2 on my ubuntu 13.10 machine, I have added another config file named paul under /etc/apache2/sites-available directory to make my file under /home/paul/public_html/ accessible on internet:

root@localhost:/etc/apache2/sites-available# ls -ltr
-rw-r--r-- 1 root root  950 Feb  7  2012 default
-rw-r--r-- 1 root root  978 Jun 23 10:54 paul

After than changes, my files under /var/www is not accessible on URL anymore, unless I change DocumentRoot from /home/paul/public_html to /var/www , but that would disable accessibility for /home/paul/public_html/

/etc/apache2/sites-available/paul :

    DocumentRoot /home/paul/public_html
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>

Is there any way of configuration to enable /var/www and /home/paul/pubilc_html as webroot at the same time? Is it required any setting on /etc/apache2/apache2.conf ? Any ideas would be appreciated, thanks.

1
So you want http://www.example.com/ to show /var/www and http://paul/ to show your public_html?tripleee
@tripleee Yeah, two different url to access my pages under two different folders.Paul Lo
Definitely possible. Two different URLs or two different domains?andrewsomething
@andrewsomething Two different URLs under same domain is good enough for mePaul Lo

1 Answers

2
votes

You can accomplish this easily with an alias directive. In /etc/apache2/sites-available/default just add an Alias for the URL.

<VirtualHost *:80>
        ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/

        Alias /paul /home/paul/public_html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Now the contents of /home/paul/public_html should be available at www.example.com/paul