View Full Version : [ubuntu] Apache includes

November 25th, 2008, 05:06 PM

After developing a site locally, I uploaded to my reseller account; however, it did not work. My host told me to prepare and an include file that they will connect to my host plan. My VHOST in my local machine is


<Directory /home/hab/www/html/gp>
Options FollowSymLinks Indexes
AllowOverride All
Allow from All
AddCharset utf-8 .html

DirectoryIndex index.php
DocumentRoot /home/hab/www/html/gp/
ServerName www.gp.loc
ServerAlias *.gp.loc
AddDefaultCharset utf-8
DirectoryIndex index.php index.html

How can I make this into include file and should be changed?

November 25th, 2008, 05:10 PM
Take your example and place it in a file - call it myvhost.conf.

Then in one of the conf files under the apache directory add:

Include /your directory/myvhost.conf


November 25th, 2008, 05:16 PM
Yea but what should I put instead my IP address

November 25th, 2008, 05:21 PM
Here's what I do. I have several websites on my servers.

<VirtualHost <HostAddr or HostName>:80>
ServerName www.mydomain.com
ServerAlias mydomain.com *.mydomain.com
CustomLog /var/log/apache2/mydomain.log common
<Directory />
Options None +FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
DocumentRoot /var/www/hosts/mydomain

Hope this helps.

November 25th, 2008, 05:28 PM
yes it did help.

Is it possible to put these config into .htaccess file

November 25th, 2008, 05:33 PM
I don't believe so.. Apache needs to know what to do upon startup and what Vhosts are available.

November 26th, 2008, 12:44 PM
Yea but what should I put instead my IP address it with a wildcard (*) unless you have a specific reason to bind it to one, and only one, address.

Note that your NameVirtualHost and VirtualHost directives should match.