Home > Apache Performance > Apache 2.0 Default Virtualhost That Works

Apache 2.0 Default Virtualhost That Works

If your server does not have any kind of graphic interface (Directadmin, Cpanel, etc…), you’ll have to create Apache Virtualhosts manually. You will need a working Virtualhost template for this. Using Apache example will guide you to problems with .htaccess files, therefore it will work too. I will show you a working example for Apache 2. Here it is:

<VirtualHost localhost.com:80>

ServerName www.localhost.com
ServerAlias www.localhost.com localhost.com
ServerAdmin webmaster@localhost.com
DocumentRoot /var/www/html/localhost.com/
UseCanonicalName OFF

<Directory /var/www/html/localhost.com>

Options +Includes -Indexes
Allowoverride All

</Directory>

</VirtualHost>

In this sample your user files are located at /var/www/html/localhost.com. It will also deny directory listing (make sure to take a look at DirectoryIndex directive and add all the necessary index types in httpd.conf). Have fun as everything you need is to change localhost.com to your domain name.

  1. No comments yet.
  1. No trackbacks yet.