
|
View Full Version : Apache VirtualHOST help :)
MasterBrian 06-01-2001, 02:40 PM Hi everybody! :)
I'm trying to set up my virtualhost on mandrake 8.0 and standard apache that come with this distribution.
I have edited my Vhost.conf file in that way:
NameVirtualHost 213.155.199.157
<VirtualHost ponzano.com www.ponzano.com>
ServerName ponzano
ServerPath /ponzano.com
DocumentRoot /web/ponzano.com
</VirtualHost>
NameVirtualHost 213.155.199.157
<VirtualHost ponzano.it www.ponzano.it>
ServerName ponzano
ServerPath /ponzano.it
DocumentRoot /web/ponzano.it
</VirtualHost>
is this correct?
My goal is to have 2 different sites, one in english under www.ponzano.com and the other in italian under www.ponzano.it
Obviously my hostname is my primary domain (www.ponzano.com)
the problem is that if I connect to www.ponzano.com or www.ponzano.it, I get the same pages (from /web/ponzano.com).
Can someone help me please?
Thank u in advance
PagesUSA 06-01-2001, 03:36 PM I use Redhat, but apache is apache.
So try this
<VirtualHost 213.155.199.157:80>
ServerName ponzano.com
ServerAlias ponzano.com www.ponzano.com
ServerAdmin you@ponzano.com
DocumentRoot /home/ponzano.com
</VIRTUALHOST>
Then repeat - changing the .com to .it.
Also, the DocumentRoot is where your index page goes. The server does not care what the folder is called. That is where it will look for your pages. So make sure you really do have the folders there and named correctly.
Also- make sure you haven't accidently uploaded the same index page to both folders.
MasterBrian 06-01-2001, 03:51 PM Thank for your fast answer,
I have done it, but without success, when I restart httpd, I got this error:
[root@www vhosts]# httpd restart
[Fri Jun 1 20:49:07 2001] [warn] VirtualHost 213.155.199.157:80 overlaps with VirtualHost 213.155.199.157:80, the first has precedence, perhaps you need a NameVirtualHost directive
What can I do?
My Vhost.conf now is:
<VirtualHost 213.155.199.157:80>
ServerName ponzano.com
ServerAlias ponzano.com www.ponzano.com
ServerAdmin root@ponzano.com
ServerPath /ponzano.com
DocumentRoot /web/ponzano.com
</VirtualHost>
<VirtualHost 213.155.199.157:80>
ServerName ponzano.it
ServerAlias ponzano.it www.ponzano.it
ServerAdmin root@ponzano.it
ServerPath /ponzano.it
DocumentRoot /web/ponzano.it
</VirtualHost>
This is what I use:
NameVirtualHost *
<VirtualHost *>
ServerAdmin staging@x2concepts.com
DocumentRoot /home/x2concepts/www
ServerName localhost
ErrorLog /home/x2concepts/error_log
CustomLog /home/x2concepts/access_log common
</VirtualHost>
<VirtualHost *>
ServerAdmin staging@dev-null.net
DocumentRoot /home/dev-null/www
ServerName localhost2
ErrorLog /home/dev-null/error_log
CustomLog /home/dev-null/access_log common
</VirtualHost>
Do you have the NameVirtualHost * in your httpd.conf now? In your first post you have two, in your second post you don't have any. I think you only need one. It works for me at least.
Regards
~Chas
Mark Vockler 06-01-2001, 06:33 PM Originally posted by MasterBrian
My goal is to have 2 different sites, one in english under www.ponzano.com and the other in italian under www.ponzano.it
You can use the following:
NameVirtualHost 213.155.199.157:80
<VirtualHost 213.155.199.157>
ServerName ponzano.com
ServerAlias www.ponzano.com
DocumentRoot /web/ponzano.com
</VirtualHost>
<VirtualHost 213.155.199.157>
ServerName ponzano.it
ServerAlias www.ponzano.it
DocumentRoot /web/ponzano.it
</VirtualHost>
Hope this helps.
Mark Vockler
Aletia Hosting
MasterBrian 06-01-2001, 08:56 PM Thank you for your answers! :)
Really this time when I do httpd restart I din't get any error, but still I browse always /web/ponzano.com for both ponzano.com and ponzano.it.
It seems so strange! :(
my hostname is www.ponzano.com, maybe I have to change is whit a name different from any dns that I have?
thank u again
PagesUSA 06-01-2001, 09:51 PM Have you tried exactly the way we showed you.
No one else is using the ServerPath directive. Frankly I am not sure what that does, but try using the examples from Mark or myself exactly as they are posted.
Are you putting this code into the last section of the httpd.conf file? Under
NAMEVIRTUALHOST 213.155.199.157:80 ?
These examples really should work. But if they don't - try digging around at http://apache.org/
Also, again, make absolutely sure you are not transferring the same page to both directories.
Chris
Planet Z 06-01-2001, 10:33 PM Mark's example looks right.
Make sure you're not forgetting the NameVirtualHost directive ABOVE the VirtualHosts, and make sure you only have ONE NameVirtualHost line for that IP.
MasterBrian 06-02-2001, 06:41 AM Originally posted by Planet Z
Mark's example looks right.
Make sure you're not forgetting the NameVirtualHost directive ABOVE the VirtualHosts, and make sure you only have ONE NameVirtualHost line for that IP.
now my Vhost.conf is exatly this:
NameVirtualHost 213.155.199.157:80
<VirtualHost 213.155.199.157>
ServerName ponzano.com
ServerAlias www.ponzano.com
DocumentRoot /web/ponzano.com
</VirtualHost>
<VirtualHost 213.155.199.157>
ServerName ponzano.it
ServerAlias www.ponzano.it
ServerPath /ponzano.it
</VirtualHost>
so, it should be correctly, as mark as shown to me (Thank u MARK! :))
I've tryed to change the hostname, with the command hostname test.test.com, but when I do httpd restart (the command to restart httpd, hope that it is right) I get segmentation fault (core dumped). Under freebsd my friend tortellini when make a changes to virtualhost need to execute a command (I think it should be vnewshost, there is something like this for linux?)
Thank u, really, u have helped me so much, I hope you will continue... :)
MasterBrian 06-02-2001, 06:49 AM Originally posted by PagesUSA
Are you putting this code into the last section of the httpd.conf file? Under
NAMEVIRTUALHOST 213.155.199.157:80 ?
Also, again, make absolutely sure you are not transferring the same page to both directories.
Chris
I do this changes in Vhost.conf, not directly in httpd.conf (Vhost is included in httpd.conf
I have specified 2 different path for ponzano.com I have pages in /web/ponzano.com and for ponzano.it in /web/ponzano
I will look in to the apache sites, but please help me :)
Thank u so much
Tim Greer 06-02-2001, 07:42 AM Your last post with the recent configuration was fine... other than one part.
Change:
ServerPath /ponzano.it
To:
DocumentRoot /path/to/ponzano.it
Restart Apache and that would cover Apache, unless you have something else misconfigured. You can also try configtest to see what it reports (you type that in in place of restart to get any warnings, errors, etc.). Also, you can check your web server logs (error_log) in your /path/to/apache/logs directory to see what that reports. Other than that one change, it should work fine and it would have to be something else in Apache that would be giving the problem.
Tim Greer 06-02-2001, 07:44 AM PS: If you are specifiying this in a separate file that Apache is including, you specify the NameVirtualHost in httpd.conf and the other directives in the included file(s).
MasterBrian 06-02-2001, 11:17 AM Yes it works!
I' ve fixed the DocumentRoot entry, with httpd restart I got always the same problem, but when I shut down the server and restart everithing works good!
Thank u all! :D
|