DeveloperSide.NET Forums
May 26, 2020, 04:07:49 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: VHost Questions  (Read 8613 times)
0 Members and 1 Guest are viewing this topic.
OneKnightHou
Customer, Basic Support
Member
*****
Posts: 13


View Profile
« on: January 09, 2007, 11:40:29 PM »

OK I have been reading and searching the forum, but before I set this up I want to make sure it is right. 

I am looking to run more than one site on Apache (currently I have 1.93 installed)and I want to set it up correctly. 

I understand that I must first edit the httpd.conf first

all I have to do is take out the # (comment tag) in front of

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf


I would then go to the extras folder and edit the httpd-vhosts.conf

NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
    ServerAdmin webmaster@mysite.info
    DocumentRoot /www/webroot/mysite
    ServerName mysite.info
    ServerAlias www.mysite.info
    ErrorLog logs/mysite-error_log
    CustomLog logs/mysite-access_log common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@othersite.com
    DocumentRoot /www/webroot/othersite
    ServerName www.othersite.com
    ErrorLog logs/othersite.com-error_log
    CustomLog logs/othersite.com-access_log common
</VirtualHost>


I would then have to place a folder / directory in the webroot directory where the documentroot would point to  that would consist of a mysite and a othersite folder

Is this correct or is there more to this ?
Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #1 on: January 10, 2007, 12:42:57 AM »

You will also need a <Directory ...> block under each VH to give access permissions. Otherwise it will deny by default.
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
OneKnightHou
Customer, Basic Support
Member
*****
Posts: 13


View Profile
« Reply #2 on: January 10, 2007, 02:06:32 AM »

So the vhost file would look like this


NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
    ServerAdmin webmaster@mysite.info
    DocumentRoot /www/webroot/mysite
    ServerName mysite.info
    ServerAlias www.mysite.info
    ErrorLog logs/mysite-error_log
    CustomLog logs/mysite-access_log common
</VirtualHost>

<Directory "/www/webroot/mysite">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

<VirtualHost *:80>
    ServerAdmin webmaster@othersite.com
    DocumentRoot /www/webroot/othersite
    ServerName www.othersite.com
    ErrorLog logs/othersite.com-error_log
    CustomLog logs/othersite.com-access_log common
</VirtualHost>

<Directory "/www/webroot/othersite">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #3 on: January 10, 2007, 02:08:31 AM »

You could do it like that, but I would rather move those dir blocks within the specific VH block.
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
OneKnightHou
Customer, Basic Support
Member
*****
Posts: 13


View Profile
« Reply #4 on: January 10, 2007, 03:09:35 AM »

OK so where would I place them ?

would I insert them after the customlog?
Logged
admin
Administrator
Master of All Subjects
*****
Posts: 3272


View Profile WWW Email
« Reply #5 on: January 10, 2007, 03:34:38 AM »

It does not matter, order is not important in this directive context.
Logged

DeveloperSide.NET
Advanced PHP and MySQL Solutions for your Web Design and Development needs with Web.Developer Server Suite.
OneKnightHou
Customer, Basic Support
Member
*****
Posts: 13


View Profile
« Reply #6 on: January 10, 2007, 03:59:52 AM »

Well this will be how I will do it ..... thanks for all you help and your work


NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
    ServerAdmin webmaster@mysite.info
    DocumentRoot /www/webroot/mysite
    ServerName mysite.info
    ServerAlias www.mysite.info
    ErrorLog logs/mysite-error_log
    CustomLog logs/mysite-access_log common
    <Directory "/www/webroot/mysite">
           Options Indexes FollowSymLinks
           AllowOverride None
           Order allow,deny
           Allow from all
     </Directory>
</VirtualHost>



<VirtualHost *:80>
    ServerAdmin webmaster@othersite.com
    DocumentRoot /www/webroot/othersite
    ServerName www.othersite.com
    ErrorLog logs/othersite.com-error_log
    CustomLog logs/othersite.com-access_log common
    <Directory "/www/webroot/othersite">
          Options Indexes FollowSymLinks
          AllowOverride None
          Order allow,deny
          Allow from all
    </Directory>
</VirtualHost>

 
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.9 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!