Create Virtual Directory with Apache HTTP Server in Fedora 13

If you want to have a “www” folder in your home directory and not to use the default: /var/www, you need to use a Virtual Directory within the Apache HTTP Server

Virtual Directories use a module called “mod_alias” wich redirects request to folders outside the server root.

Lets create a virtual directory that will be located in: /home/user/www and will be accessed via: http://url/user

1.- Edit the configuration file (as root)

$ vi /etc/httpd/conf/httpd.conf

Look for the section “Aliases” we’ll write the following lines:

Alias /user “/home/user/www/”

<Directory "/home/user/www">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Save and close the file.

2.- Restart the service with:

(as root)
$ /etc/init.d/httpd restart

3.- Create the folder “www” in: /home/user and a file to test.

$ mkdir /home/user/www
$ cd ~/www
$ vi index.html

Now we should be able to access the fies of the folder: “/home/user/www” via http://url/user&#8221;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s