Creating a Virtual Directory on linux (ubuntu) and Apache2

Creating a Virtual Directory on linux (ubuntu) and Apache2

Postby intodis » 09 Jan 2007, 03:21

Add a folder /home/me/websites/myfolder and copy in website content

Add a folder /home/me/websites/myfolder.conf.d and create a text file called myfolder
Paste the following into this file and save
Code: Select all
AliasMatch ^/apache2-default/myfolder(.*) "/home/me/websites/myfolder/$1"
AliasMatch ^/myfolder(.*) "/home/me/websites/myfolder/$1"
<Directory "/home/me/websites/myfolder/">
    Options Indexes
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from  127.0.0.0/255.0.0.0 ::1/128
</Directory>


Finally execute the following commands, the lines do the following:
1. Copy's the folder's configuration into apache2
2. Gives permissions to the folder
3. Restarts apache
Code: Select all
cd /home/me/websites/myfolder.conf.d
sudo cp myfolder /etc/apache2/conf.d
sudo chmod -R 755 /home/me/websites/myfolder
sudo /etc/init.d/apache2 restart


Now if your index.html is a valid page going to /localhost/myfolder in firefox will show the page
intodis
Site Admin
 
Posts: 204
Joined: 30 Mar 2006, 20:57

Return to Apache

Who is online

Users browsing this forum: No registered users and 1 guest

cron