Re: setting up virtual hosting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Sam Carleton wrote:
> Matt,
>
> I do want to set things up as you suggested, but it isn't working.
> When I type in the IP address, I get the webdev.miltonstreet.com site
> on port 80 and the subversion site on port 443.  Here is what I have:
>
> Listen 80
> Listen 443
>
> NameVirtualHost 192.168.0.4:80
>
> ServerAdmin scarleton@xxxxxxxxxxxxxxxx
> ServerName internal.miltonstreet.com
>
> DocumentRoot "/http/www/internal"
>
> <VirtualHost _default_:80>
>    ServerName internal.miltonstreet.com
>    DocumentRoot "/http/www/internal"
> </VirtualHost>
>
> <Directory "/http/www/internal">
>    Options None
>    AllowOverride None
>    Order allow,deny
>    Allow from all
> </Directory>
>
> <VirtualHost webdev.miltonstreet.com:80>
>
>    ServerName      webdev.miltonstreet.com
>    DocumentRoot    "/http/www/webdev.miltonstreet.com"
>
>    ErrorLog /var/log/apache2/webdev.miltonstreet.com-error_log
>    CustomLog /var/log/apache2/webdev.miltonstreet.com-access_log combined
>
>    <Directory "/http/www/webdev.miltonstreet.com">
>        Options Indexes FollowSymLinks
>        AllowOverride None
>        Order allow,deny
>        Allow from all
>    </Directory>
>
> </VirtualHost>
>
> <VirtualHost *:443>
>    DocumentRoot "/http/www/internal"
> </VirtualHost>
>
> <VirtualHost subversion.miltonstreet.com:443>
>
>    ServerName subversion.miltonstreet.com
>    DocumentRoot "/http/subversion/wwwRoot"
>
>    <Directory /http/subversion/wwwRoot>
>        Order Allow,Deny
>        Allow from all
>    </Directory>
>
>    # more stuff here
>
> </VirtualHost>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
>   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
>
>
I suggest you dont bother with default for now, just comment that out,
and make the first vhost your private IP, then the second IP your public IP,
I know it sounds weird but it will cover both bases. It will work, now
the default will never be needed, if no hosts - then one of the IP
addresses.
Let me know if for some reason it doesnt, Mass irtual Hosting is a bit
different and I may have led you up the garden poath before, after
checking it appears I dont use default anywhere, but just hard code the IPs.


Listen 80
Listen 443

NameVirtualHost 192.168.0.4:80

ServerAdmin scarleton@xxxxxxxxxxxxxxxx
ServerName internal.miltonstreet.com
DocumentRoot "/http/www/internal"

#in the next two you can choose whether to have servername equal to IP
or set it to the IP
<VirtualHost 192.168.0.4:80>
#   ServerName 192.168.0.4
   ServerName internal.miltonstreet.com
   DocumentRoot "/http/www/internal"
</VirtualHost>
<VirtualHost your.public.ip.here:80>
#   ServerName your.public.ip.here
   ServerName internal.miltonstreet.com
   DocumentRoot "/http/www/internal"
</VirtualHost>

#this just has some placeholder right?
<Directory "/http/www/internal">
   Options None
   AllowOverride None
   Order allow,deny
   Allow from all
</Directory>


#now the only way that a request will come to here is if it matches.
<VirtualHost webdev.miltonstreet.com:80>
   ServerName      webdev.miltonstreet.com
   DocumentRoot    "/http/www/webdev.miltonstreet.com"
   ErrorLog /var/log/apache2/webdev.miltonstreet.com-error_log
   CustomLog /var/log/apache2/webdev.miltonstreet.com-access_log combined
   <Directory "/http/www/webdev.miltonstreet.com">
       Options Indexes FollowSymLinks
       AllowOverride None
       Order allow,deny
       Allow from all
   </Directory>
</VirtualHost>


<VirtualHost 192.168.0.4:443>
#   ServerName 192.168.0.4
   DocumentRoot "/http/www/internal"
</VirtualHost>
<VirtualHost your.public.ip.here:443>
#   ServerName your.public.ip.here
   DocumentRoot "/http/www/internal"
</VirtualHost>


<VirtualHost subversion.miltonstreet.com:443>
   ServerName subversion.miltonstreet.com
   DocumentRoot "/http/subversion/wwwRoot"
   <Directory /http/subversion/wwwRoot>
       Order Allow,Deny
       Allow from all
   </Directory>
   # more stuff here
</VirtualHost>

now just have
192.168.0.4 subversion.miltonstreet.com webdev.miltonstreet.com


-- 
Matthew Farey



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux