PDA

View Full Version : [ubuntu] Apache includes



OOzypal
November 25th, 2008, 05:06 PM
Hello,

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

NameVirtualHost 192.168.1.2

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

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



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

sdnelson
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

Done..

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

sdnelson
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
</Directory>
DocumentRoot /var/www/hosts/mydomain
</VirtualHost>

Hope this helps.

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

Is it possible to put these config into .htaccess file

sdnelson
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.

MJN
November 26th, 2008, 12:44 PM
Yea but what should I put instead my IP address 192.168.1.2Replace 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.

Mathew