Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 28th September 2008, 07:11
rbradshaw rbradshaw is offline
Junior Member
 
Join Date: Aug 2008
Posts: 15
Thanks: 5
Thanked 0 Times in 0 Posts
Default virtual host problems

i have installed ubuntu 8.04 server from the perfect server howto and ive added two virtual hosts to /etc/apache2/sites-available/default:

<VirtualHost *>
ServerAdmin webmaster@site1.com
DocumentRoot /home/user/htdocs/public_html
ServerAlias site1.com *.site1.com
</VirtualHost>


<VirtualHost *>
ServerAdmin webmaster@site2.com
DocumentRoot /home/user/htdocs/public_html
ServerAlias site2s.co.uk *.site2.co.uk
</VirtualHost>

when i type my ip into a browser it comes up with the 'it works' page, when i type the site1 url it loads the index page in the document root folder but when i type the site2 url it come up with an internal server error.

can anybody please help correct this?

thanks.
Reply With Quote
Sponsored Links
  #2  
Old 28th September 2008, 23:18
rayit rayit is offline
Member
 
Join Date: Nov 2005
Posts: 93
Thanks: 0
Thanked 2 Times in 2 Posts
Default try this?

maybe you could try adding *:80

???

gr
Raymond
RayIT


# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80

<VirtualHost *:80>

DocumentRoot /www/example1
ServerName www.example1.com

# Other directives here


</VirtualHost>

<VirtualHost *:80>

DocumentRoot /www/example2
ServerName www.example2.org

# Other directives here


</VirtualHost>
Reply With Quote
The Following User Says Thank You to rayit For This Useful Post:
rbradshaw (30th September 2008)
  #3  
Old 28th September 2008, 23:26
rbradshaw rbradshaw is offline
Junior Member
 
Join Date: Aug 2008
Posts: 15
Thanks: 5
Thanked 0 Times in 0 Posts
Default

by doing that it now displays the default page saying 'it works' for both domains.
Reply With Quote
  #4  
Old 29th September 2008, 18:30
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,751 Times in 2,581 Posts
Default

Try to add ServerName directives to each vhost. If that doesn't help, check Apache's error log.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
The Following User Says Thank You to falko For This Useful Post:
rbradshaw (30th September 2008)
  #5  
Old 30th September 2008, 13:55
zcworld zcworld is offline
Senior Member
 
Join Date: Jul 2006
Location: South Australia
Posts: 329
Thanks: 2
Thanked 37 Times in 37 Posts
Send a message via MSN to zcworld Send a message via Skype™ to zcworld
Default

this is my vhost conf file i use


<VirtualHost *:80>
ServerName vdb.site.lan

DocumentRoot /var/www/vhosts/site.lan/vdb/def/

<Directory /var/www/vhosts/site.lan/vdb/def/>
Options Indexes FollowSymLinks MultiViews
</Directory>

CustomLog /var/www/logs/def.vdb.site.lan_access.log combined
ErrorLog /var/www/logs/def.vdb.site.lan_error.log


</VirtualHost>


##############################

<VirtualHost *:80>
ServerName list.vdb.site.lan
DocumentRoot /var/www/vhosts/site.lan/vdb/list/

<Directory /var/www/vhosts/site.lan/vdb/list/>
Options Indexes FollowSymLinks MultiViews
</Directory>

CustomLog /var/www/logs/list.vdb.site.lan_access.log combined
ErrorLog /var/www/logs/list.vdb.site.lan_error.log


if you adding this to your httpd.conf file or the defualt apache conf file

make sure you have before any vhost
NameVirtualHost *:80

<vhost here >

than restart apache and try it

make sure you add to you /etc/host (on linux) or c:\windows\system32\etc\hosts

IP / DNS
192.168.1.25 vdb.site.lan
192.168.1.25 list.vdb.site.lan



so on
__________________
Shane Ebert :: Facebok
Reply With Quote
The Following User Says Thank You to zcworld For This Useful Post:
rbradshaw (30th September 2008)
  #6  
Old 30th September 2008, 20:27
rbradshaw rbradshaw is offline
Junior Member
 
Join Date: Aug 2008
Posts: 15
Thanks: 5
Thanked 0 Times in 0 Posts
Default

thank you all for your help, its working now
Reply With Quote
  #7  
Old 3rd October 2008, 09:39
zcworld zcworld is offline
Senior Member
 
Join Date: Jul 2006
Location: South Australia
Posts: 329
Thanks: 2
Thanked 37 Times in 37 Posts
Send a message via MSN to zcworld Send a message via Skype™ to zcworld
Default

Quote:
Originally Posted by danica View Post
To do name based virtual hosts in Apache, you have to
have a NamedVirtualHost (not sure if that's exactly the right
directive) entry that gives the IP where you'll put the hosts.
Then, the VirtualHost entries have to use that same IP
address in their declaration. I'm not sure you can get away
with the asterick like that, but I could be wrong.


ok
the *:80
as far as i know
anyname : port 80

than the ServerName tell Apache what is the name of the Vhost
__________________
Shane Ebert :: Facebok
Reply With Quote
  #8  
Old 14th January 2010, 02:43
mattg2379 mattg2379 is offline
Junior Member
 
Join Date: Jan 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi.

Im sorry for posting this here. It's 'kind of' on topic, as it's a vhost issue, but relating to .htaccess. I cant find anywhere on the forum to post a new topic, so Ive had to reply to an existing one.

My issue is this:

I now have ISPConfig 3 set up beautifully on Ubuntu (with thanks to Falko on a previous thread), but one of my vhosts runs wordpress that uses a permalink structure. I have a .htaccess file that used to work on the old hosting environment, but whenever I include it with these contents in the root of the site, I get a 500 error. .htaccess has this in:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]

RewriteRule ^/?([0-9]+)?/ /index.php?p=$1 [QSA]
</IfModule>

How can I add it in to make sure it works? Ive tried setting AllowOverride to All instead of None, Ive attempted adding parts of the rewrite rule into the Apache directives input box for the domain - nothing.. I cannot get it to work.

Please, please help me.

Many thanks
Reply With Quote
  #9  
Old 14th January 2010, 12:07
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,751 Times in 2,581 Posts
Default

Any errors in Apache's error log?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #10  
Old 14th January 2010, 16:06
mattg2379 mattg2379 is offline
Junior Member
 
Join Date: Jan 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default

[Thu Jan 14 00:16:31 2010] [alert] [client 81.104.45.104] /var/www/clients/client2/web8/web/.htaccess: RewriteEngine not allowed here, referer: http://www.mydomain.com/


and this is my conf file for the vhost:

<Directory /var/www/domainname.com>
AllowOverride None
Order Deny,Allow
Deny from all
</Directory>

<VirtualHost *:80>
DocumentRoot /var/www/clients/client2/web8/web

ServerName domainname.com
ServerAlias www.domainname.com
ServerAdmin webmaster@domainname.com

ErrorLog /var/log/ispconfig/httpd/domainname.com/error.log

ErrorDocument 400 /error/400.html
ErrorDocument 401 /error/401.html
ErrorDocument 403 /error/403.html
ErrorDocument 404 /error/404.html
ErrorDocument 405 /error/405.html
ErrorDocument 500 /error/500.html
ErrorDocument 503 /error/503.html

<Directory /var/www/domainname.com/web>
Options FollowSymLinks
AllowOverride Indexes AuthConfig Limit
Order allow,deny
Allow from all
</Directory>
<Directory /var/www/clients/client2/web8/web>
Options FollowSymLinks
AllowOverride Indexes AuthConfig Limit
Order allow,deny
Allow from all
</Directory>

# cgi enabled
<Directory /var/www/clients/client2/web8/cgi-bin>
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ /var/www/clients/client2/web8/cgi-bin/
AddHandler cgi-script .cgi
AddHandler cgi-script .pl
# php as cgi enabled
ScriptAlias /php5-cgi /var/www/php-cgi-scripts/web8/php-cgi-starter
Action php5-cgi /php5-cgi
AddHandler php5-cgi .php .php3 .php4 .php5
<Directory /var/www/php-cgi-scripts/web8/>
Order allow,deny
Allow from all
</Directory>


</VirtualHost>

Last edited by mattg2379; 14th January 2010 at 16:22.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with virtual host meth General 3 11th September 2008 15:15
Disabling HTTP TRACE / TRACK in all virtual host rdike Installation/Configuration 8 11th May 2008 04:41
Postfix problem: lost connection after CONNECT from unknown fernando_torrez Server Operation 5 30th November 2007 15:17
ISPConfig DNS and virtual host configuration tips and problem Ripper Installation/Configuration 6 26th June 2007 01:29
This is %#@*&^$# embarrassing! domino Smalltalk 34 5th February 2007 22:57


All times are GMT +2. The time now is 18:47.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.