On: Centos 5.2, with httpd-2.2.3-11.el5_1.centos.3
I tried to bring up a web server using an httpd.con that runs well
on: Fedora 8, with httpd-2.2.8-1.fc8
as well as several earlier versions, going back to Fedora 4.
On the Centos version, I cannot successfully: run a NameVirtualHost; execute a CGI.
I can bring up a simple page if I avoid the above.
Suggestions would be much appresiated. Thanks, Mike.
Mike -- EMAIL IGNORED wrote:
On: Centos 5.2, with httpd-2.2.3-11.el5_1.centos.3
I tried to bring up a web server using an httpd.con that runs well
On the Centos version, I cannot successfully: run a NameVirtualHost; execute a CGI.
I can bring up a simple page if I avoid the above.
Don't we all like puzzles? All those hundreds of pieces which look similar? Is that blue one there sky or is it the water? The green one over there - is it a tree? Is it a part of that house which has been painted green?
If you want to solve that puzzle, it often helps to look at the picture on the top of the box.
IOW: What did you try to do? What happened? What did you expect to happen? What does your config look like? Are there any errors in the log file?
Ralph
On Thu, 09 Oct 2008 17:51:54 +0200, Ralph Angenendt wrote:
[...]
Don't we all like puzzles? All those hundreds of pieces which look similar? Is that blue one there sky or is it the water? The green one over there - is it a tree? Is it a part of that house which has been painted green?
If you want to solve that puzzle, it often helps to look at the picture on the top of the box.
IOW: What did you try to do? What happened? What did you expect to happen? What does your config look like? Are there any errors in the log file?
Ralph
[...]
Indeed. Here is a summary:
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" ... NameVirtualHost 192.168.9.21:80 NameVirtualHost 127.0.0.1:80 ... <VirtualHost 192.168.9.21:80> <Location /> Order allow,deny # Allow from All Deny from all </Location> </VirtualHost>
<VirtualHost 192.168.9.21:80 127.0.0.1:80> ServerName new.rosemike.net Options -All SymLinksIfOwnerMatch ExecCGI DocumentRoot "/var/www/html/www" DirectoryIndex index.cgi RewriteEngine on RewriteOptions Inherit ... RewriteRule ^/$ - [L] ... </VirtualHost>
All access attempts are with http://new.rosemike.net/ with that name appropriately defined in hosts files, as verified by ping.
Now run as shown, the client gets: "You don't have permission to access / on this server." If you comment out the first VirtualHost block: you get the same thing If you then add to the second virtual host block: <Location /> Allow from All </Location> you get: "You don't have permission to access /index.cgi on this server." (note that there are links to index.cgi in all directories.) if you comment out Servername nothing changes If you now expose the first VirtualHost block and change to Allow from All Deny from None you get the page displayed, but not via the CGI, as verified by absence debug text the CGI would have added, as well as nothing in a log the CGI writes.
Well, you asked. BTW, I emphasize that this configuration works well on Fedora, which you can see at www.rosemike.net .
Thanks for your interest. Mike.
Mike -- EMAIL IGNORED wrote:
On Thu, 09 Oct 2008 17:51:54 +0200, Ralph Angenendt wrote:
[...]
[...] IOW: What did you try to do? What happened? What did you expect to happen? What does your config look like? Are there any errors in the log file?
Ralph
[...]
Indeed. Here is a summary: [...]
What do you get in the error_log?
On Thu, 09 Oct 2008 10:14:54 -0700, Jerry Franz wrote:
[...]
What do you get in the error_log?
I found the CGI problem (mia culpa), and the CGI is now working, but the NameVirtualHost still has a problem.
NameVirtualHost 192.168.9.21:80 NameVirtualHost 127.0.0.1:80 ...
<VirtualHost 192.168.9.21:80> <Location /> Order allow,deny Allow from None Deny from All </Location> </VirtualHost>
<VirtualHost 192.168.9.21:80 127.0.0.1:80> ServerName new.rosemike.net Options -All SymLinksIfOwnerMatch ExecCGI DocumentRoot "/var/www/html/www" DirectoryIndex index.cgi RewriteEngine on ...
With the above I get: [client 192.168.9.10] client denied by server configuration: /var/www/html/www/ [client 192.168.9.10] client denied by server configuration: /var/www/error/noindex.html
If I comment out the first VirtualHost block I get correct function. Most notably, "correct function" persists if I comment out the ServerName line. It appears the ServerName line is ignored in all cases. I also tried changing the order of the VirtualHost blocks. No change.
Thanks again for your interest. Mike.
On Thu, 09 Oct 2008 18:07:08 +0000, Mike -- EMAIL IGNORED wrote:
[...]
I have additional information that ServerName is not working. My system requires two virtual hosts with different values of ServerName. If they share an IP address, the system fails. But if each virtual host has a unique IP address, the system works.
In other words, ServerName alone fails to distinguish two named virtual hosts.
Mike.
Mike -- EMAIL IGNORED wrote on Thu, 9 Oct 2008 19:28:39 +0000 (UTC):
In other words, ServerName alone fails to distinguish two named virtual hosts.
Oh, it sure does. If it is present in both - which it isn't in your config.
Kai
On Thu, 09 Oct 2008 21:43:24 +0200, Kai Schaetzl wrote:
Mike -- EMAIL IGNORED wrote on Thu, 9 Oct 2008 19:28:39 +0000 (UTC):
In other words, ServerName alone fails to distinguish two named virtual hosts.
Oh, it sure does. If it is present in both - which it isn't in your config.
Kai
Yes, a retest confirms your observation. I am therefore left with the need to remove the VirtualHost that has no ServerName. I can access the site with an IP address, which, I think, this is meant to prevent.
Mike.
Mike -- EMAIL IGNORED wrote on Thu, 9 Oct 2008 20:14:10 +0000 (UTC):
I am therefore left with the need to remove the VirtualHost that has no ServerName. I can access the site with an IP address, which, I think, this is meant to prevent.
I still don't see the purpose of that virtual host. If it is for "catching" IP only accesses there are several methods to do this. Look for "default virtualhost" in the apache documentation (and in the config template coming with CentOS). Also, if that single virtualhost documentroot and the main documentroot (in httpd.conf) are not the same then all non-hostname access will got to the main server documentroot and not your virtual host.
Kai
On Thu, 09 Oct 2008 22:42:06 +0200, Kai Schaetzl wrote:
[...]
I still don't see the purpose of that virtual host. If it is for "catching" IP only accesses there are several methods to do this. Look for "default virtualhost" in the apache documentation (and in the config template coming with CentOS). Also, if that single virtualhost documentroot and the main documentroot (in httpd.conf) are not the same then all non-hostname access will got to the main server documentroot and not your virtual host.
Kai
Following your suggestions, everything now working correctly.
Thanks, Mike.
Mike -- EMAIL IGNORED wrote:
On Thu, 09 Oct 2008 21:43:24 +0200, Kai Schaetzl wrote:
Mike -- EMAIL IGNORED wrote on Thu, 9 Oct 2008 19:28:39 +0000 (UTC):
In other words, ServerName alone fails to distinguish two named virtual hosts.
Oh, it sure does. If it is present in both - which it isn't in your config.
Kai
Yes, a retest confirms your observation. I am therefore left with the need to remove the VirtualHost that has no ServerName. I can access the site with an IP address, which, I think, this is meant to prevent.
Mike.
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
You need to remove the :80 in the VirtualHost declarations that contains Servername entries.
I have several Domain and Sub-Domain host names running against one IP using the VirtualHost pratice. My most recent server is running on CentOS 5.2.
Michael Peterson wrote on Thu, 09 Oct 2008 16:09:54 -0500:
You need to remove the :80 in the VirtualHost declarations that contains Servername entries.
No, that's perfectly ok and recommended. His problem was that he was using a virtual host without a ServerName directive.
Kai
Michael Peterson wrote on Thu, 09 Oct 2008 16:09:54 -0500:
You need to remove the :80 in the VirtualHost declarations that contains Servername entries.
No, that's perfectly ok and recommended. His problem was that he was using a virtual host without a ServerName directive.
Kai
-- Kai Schätzl, Berlin, Germany Get your web at Conactive Internet Services: http://www.conactive.com
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
I run a Virtual Host entry without a ServerName directive and have been through several releases of CentOS and Apache and all works fine for me.
On Thu, 09 Oct 2008 20:03:13 -0500, Michael Peterson wrote:
Michael Peterson wrote on Thu, 09 Oct 2008 16:09:54 -0500:
You need to remove the :80 in the VirtualHost declarations that contains Servername entries.
No, that's perfectly ok and recommended. His problem was that he was using a virtual host without a ServerName directive.
Kai
-- Kai Schätzl, Berlin, Germany Get your web at Conactive Internet Services: http://www.conactive.com
_______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
I run a Virtual Host entry without a ServerName directive and have been through several releases of CentOS and Apache and all works fine for me.
Have you run several Virtual Hosts with the same IP address?
Mike.
Have you run several Virtual Hosts with the same IP address?
Yes, I run multiple Virtual Hosts on my development server and they all look like this:
NameVirtualHost *:80
<VirtualHost *:80> DocumentRoot /var/www/html/site1 ServerName site1.localhost other stuff .... </VirtualHost>
<VirtualHost *:80> DocumentRoot /var/www/html/site2 ServerName site2.localhost other stuff .... </VirtualHost>
<VirtualHost *:80> DocumentRoot /var/www/html/site3 ServerName site3.localhost other stuff .... </VirtualHost>
Have you got your ServerNames set up properly in /etc/hosts or DNS?
On Fri, 10 Oct 2008 18:01:24 +0930, admin wrote:
Have you run several Virtual Hosts with the same IP address?
Yes, I run multiple Virtual Hosts on my development server and they all look like this:
NameVirtualHost *:80
<VirtualHost *:80> DocumentRoot /var/www/html/site1 ServerName site1.localhost other stuff ....
</VirtualHost>
<VirtualHost *:80> DocumentRoot /var/www/html/site2 ServerName site2.localhost other stuff ....
</VirtualHost>
<VirtualHost *:80> DocumentRoot /var/www/html/site3 ServerName site3.localhost other stuff ....
</VirtualHost>
Have you got your ServerNames set up properly in /etc/hosts or DNS?
All in hosts; my stuff is working now. My last query was really addressed to Michael Peterson, who indicated that he omits ServerName.
Mike.
Michael Peterson a écrit :
Michael Peterson wrote on Thu, 09 Oct 2008 16:09:54 -0500:
You need to remove the :80 in the VirtualHost declarations that contains Servername entries.
No, the ':80' is ok.
No, that's perfectly ok and recommended. His problem was that he was using a virtual host without a ServerName directive.
I run a Virtual Host entry without a ServerName directive and have been through several releases of CentOS and Apache and all works fine for me.
Are you talking about IP based or name based virtual hosts (single IP, multiple vhosts)?
if using name based vhosts, Apache needs to know which config to server for which vhost. In the case of multiple names for a single IP, Servername is here for that.
Michael Peterson wrote on Thu, 9 Oct 2008 20:03:13 -0500 (CDT):
I run a Virtual Host entry without a ServerName directive and have been through several releases of CentOS and Apache and all works fine for me.
You can do that, it depends on your configuration. A standard name-based virtual host configuration will not work without a ServerName directive, because it's that directive (and the ServerAlias ones) that has to match what the client sends as Host header. Have a look at the documentation instead of guessing ;-)
Kai
Kai Schaetzl wrote:
Michael Peterson wrote on Thu, 9 Oct 2008 20:03:13 -0500 (CDT):
I run a Virtual Host entry without a ServerName directive and have been through several releases of CentOS and Apache and all works fine for me.
You can do that, it depends on your configuration. A standard name-based virtual host configuration will not work without a ServerName directive, because it's that directive (and the ServerAlias ones) that has to match what the client sends as Host header. Have a look at the documentation instead of guessing ;-)
Kai
I did not guess. I have always consulted the documentation first. I have my Apache configuration file setup according the currently available Apache documentation.
Pardon my lack of sleep after consulting my configuration file again. I do not use ServerAlias at all. I do use ServerName for all of my VirtualHost entries however.
Please do not assume people guess just because they do not provide a link to back up the information they provide. If it is not an answer from experience only, I take it that maybe to please those that need it I should post a link for reference in the future. I am doing tasks with CentOS that are however undocumented other than by me at the present time in some cases however.
I have been working with Apache for over 8 years and do not belong to just this list thank you. I consult any available manuals and online documentation first before asking a list anything.
After such a blatant insult I should think about dropping this list. But I think other than your lack of disregard for my try at providing assistance to the list. I have something to offer even if no one else is doing the things I am doing with CentOS at the present time. I think for the time being other than a post I am working on to answer a post I made earlier this month that has went unanswered so far that I will just watch and learn and try to keep my fingers quiet as much as possible as far as this list is concerned.
In your first sentence you say "You can do that, it depends on your configuration. ". Did you consult the documentation or are you asking me to do it for you.
Here is one of the sources for the Name Virtual Host issue resolutions: http://httpd.apache.org/docs/2.2/vhosts/name-based.html
This example is straight from the documentation listed above.
" |NameVirtualHost *:80
<VirtualHost *:80> ServerName www.domain.tld ServerAlias domain.tld *.domain.tld DocumentRoot /www/domain </VirtualHost>
<VirtualHost *:80> ServerName www.otherdomain.tld DocumentRoot /www/otherdomain </VirtualHost> "
There is no ServerAlias for the second VirtualHost entry. This is per the Apache standard straight from the available current online documentation.
I only use ServerName and have not tried ServerAlias. I hope this solves the NameVIrtualHost issue for the time being at least.
| Michael
Michael Peterson wrote on Sun, 12 Oct 2008 22:24:09 -0500:
I did not guess.
When you replied the first time, you *did* guess. It is quite obvious that you do not need to remove what you suggested.
I have been working with Apache for over 8 years
I can top that easily. So, what?
After such a blatant insult I should think about dropping this list.
Then please do. I didn't insult you in any way. It's you who's suddenly begun to flame. I haven't seen such a reaction for a long time on this list.
In your first sentence you say "You can do that, it depends on your configuration. ".
Then please read what I wrote in that sentence instead of flaming. You cannot just say "I do not use it" and present this as the solution. It depends on the configuration and for almost all configurations it will not work! Especially not for the one Mike is using.
This example is straight from the documentation listed above.
Yeah. And, amazingly, wow, it has ServerName in it. Something that you suggested to omit. And it's got the port as well, something else you suggested to omit. Hm. Should I follow the documentation or should I follow your advice?
There is no ServerAlias for the second VirtualHost entry.
I suggest you read again what I wrote instead of flaming. Maybe then you understand what I wrote. I figure that you may have confused ServerName and ServerAlias. Maybe you meant to say "I run a Virtual Host entry without a *ServerAlias* directive". Just that we weren't talking about ServerAlias. Even if we had, that's not an excuse for such a flame.
I hope this solves the NameVIrtualHost issue for the time being at least.
It definitely does not as you are confusing people as best as you can with your writings.
I only use ServerName and have not tried ServerAlias.
You didn't ever use that in "over 8 years" of experience with Apache? Don't answer, this was a rhetorical question.
No, I won't answer any more of your flames.
Kai
what's the purpose of that whole confusing configuration? If you want to use IP-based virtualhosts *any* of them needs a servername. And why do you enclose the Location statement in a virtualhost? Why don't you simply specify the real location? And I would use <Location "/"> to make it look less like XML.
Options -All SymLinksIfOwnerMatch ExecCGI
you don't need to remove All
From my perspective you aim at a really hard to read and understand
configuration. I wouldn't ever dare to mix the IP-based hosts like you try to do. Simplify your config and it will work.
Kai
On Thu, 09 Oct 2008 21:31:19 +0200, Kai Schaetzl wrote:
what's the purpose of that whole confusing configuration? If you want to use IP-based virtualhosts *any* of them needs a servername. And why do you enclose the Location statement in a virtualhost? Why don't you simply specify the real location? And I would use <Location "/"> to make it look less like XML.
Options -All SymLinksIfOwnerMatch ExecCGI
you don't need to remove All
From my perspective you aim at a really hard to read and understand
configuration. I wouldn't ever dare to mix the IP-based hosts like you try to do. Simplify your config and it will work.
Kai
If I understand you correctly, you indicate that I should remove the VirtualHost that does not contain a ServerName, advice in the delivered httpd.config file notwithstanding. In fact, that is how I now have it, thereby eliminating the protection against IP address access, which I would rather have.
In any case, as I indicate in another post, it still fails to properly distinguish on the basis of ServerName.
Mike.