Linux-Noob Forums

Full Version: vhost
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Trying to configure Vhost on Ubuntu Server but not going well.

I can configure one site and everything work well,

as soon as I configure second site not able to access any site

 

 

using xxx.xx.4.10/firstsite

OR

xxx.xx.4.10/secondsite

 

So when configuring Vhost what should be done?

i.e

what changes should be done

/etc/apache2/sites-available/default

/etc/apache2/sites-available/www.firstsite.com

/etc/apache2/sites-available/www.second.com

 

OR SHOULD I be changing

 

etc/apache2/apache.conf

 

 

 

Here are my configuration where should I change

(I have just change the first part and the rest left it as default)

 

sudo nano /etc/apache2/sites-available/default

NameVirtualHost *:80

<VirtualHost *:80>

ServerAdmin webmaster@localhost

 

DocumentRoot /var/www/firstsite

ServerName www.firstsite.com

ServerAlias firstsite.com

#Second site

</Virtualhost>

<VirtualHost *:80>

DocumentRoot /var/www/secondsite

ServerName www.secondsite.com

ServerAlias secondsite.com

<Directory />

Options FollowSymLinks

AllowOverride None

</Directory>

<Directory /var/www/>

Options Indexes FollowSymLinks MultiViews

AllowOverride None

 

 

***********

sudo nano /etc/apache2/sites-available/www.firstsite.com

NameVirtualHost *:80

<VirtualHost *:80>

ServerAdmin webmaster@localhost

 

DocumentRoot /var/www/firstsite

ServerName www.firstsite.com

ServerAlias firstsite.com

 

<Directory />

Options FollowSymLinks

AllowOverride None

</Directory>

<Directory /var/www/>

 

 

 

Options Indexes FollowSymLinks MultiViews

AllowOverride None

Order allow,deny

allow from all

</Directory>

 

**********

sudo nano /etc/apache2/sites-available/www.second.com

NameVirtualHost *:80

<VirtualHost *:80>

ServerAdmin webmaster@localhost

 

DocumentRoot /var/www/secondsite

ServerName www.secondsite.com

ServerAlias secondsite.com

<Directory />

Options FollowSymLinks

AllowOverride None

</Directory>

<Directory /var/www/>

Options Indexes FollowSymLinks MultiViews

AllowOverride None

Order allow,deny

allow from all

</Directory>

****

/etc/apache2/sites-available# ls -l

total 12

-rw-r--r-- 1 root root 1236 2008-08-05 09:32 default

-rw-r--r-- 1 root root 1091 2008-08-05 09:28 www.firstsite.com

-rw-r--r-- 1 root root 1080 2008-08-05 09:34 www.secondsite.com

 

 

Reloading apache I got the following error

 

 

# sudo /etc/init.d/apache2 reload

* Reloading web server config apache2

apache2: Could not reliably determine the server's fully qualified domain nam

using xxx.xxxx.xxx.10 for ServerName

[Tue Aug 05 09:57:01 2008] [warn] NameVirtualHost *:80 has no VirtualHosts

[Tue Aug 05 09:57:01 2008] [warn] NameVirtualHost *:80 has no VirtualHosts

[Tue Aug 05 09:57:01 2008] [warn] NameVirtualHost *:80 has no VirtualHosts

have you looked at this post ?

Yes I have followed that articule.

I think where I am going wrong is with Apache2 there is no httpd.conf, its just empty.

Searching on the net point to configuring apache2.conf or default.conf.

So thats where I am loosing all my hair now.

Tried all I could think of but no luck.

 

Any example of a working config will be much appriciated.

And which file was configured i.e apache2.conf or default.conf?

 

 

OR

 

is it the way I am testing the server.

I have a PC directly connected to server.

 

Thanks


hi i've just installed apache2 here on my fedora 9 box and the httpd.conf file is located in /etc/httpd/conf

 

do you see that on yours ?

 

what version of Ubuntu are you using and are you following an Ubuntu guide, if so which one ?


for ubuntu read this

 

http://ubuntuguide.org/wiki/Ubuntu:Hardy#A...our_LAMP_server

 

plus (advice from milligan)

 

Quote:make sure that there isn't some kind of problem with his vhosts localy only. If he goes through a router/switch and stuff, he might have problems querying his own adress, and will have to add it to /etc/hosts
Thanks all working now.