|
Apache VirtualHost - How to Create |
|
|
|
|
Create a virtual host you should have Apache installed on you server and I assume you have Apache installed and running. Simply follow the following steps to create the VH. Linux Users - "cd /etc/apache2/sites-available"
- "vim <yourdomain>.conf "(make sure to do this as super user)
- Type the following in the configuration file. (check <yourdomain>.conf bellow)
- Save and exit.
- "vim /etc/hosts" as super user and add following line.
- Type "a2ensite <yourdomain>.conf" as super user to enable the VH.
- Reload Apache configuration using "/etc/init.d/apache2 reload" as super user.
<yourdomain>.conf
<VirtualHost *:80>
ServerAdmin <server admin email>
DocumentRoot /var/www/<folder name>
ServerName <yourdomain>
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
hosts
127.0.0.1 localhost
127.0.0.1 localhost <yourdomain>
Trackback(0)
 |