LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Apache Issue... (Please Help Me Before I Shoot Myself) (https://www.linuxquestions.org/questions/linux-networking-3/apache-issue-please-help-me-before-i-shoot-myself-336024/)

Vito_Corleone 06-22-2005 04:03 AM

Apache Issue... (Please Help Me Before I Shoot Myself)
 
Ok, basically, i've been running an Apache server for awhile now, never had to tackle Virtual Hosts, and i've had little problems with the other things i've had to learn. Well, i've been at this for about 6 hours straight (sounds long, but i actually had a friend SSH in and try to fix it, but in the process, he actually corrupted my box so i had to go with a fresh install, at which time i found out, through a good amount of trouble shooting, that my FC4 dvd was bad). Anyway, i'm at my wit's end, and if someone could tell me what'd wrong with my httpd.conf file, i'd be EXTREMELY grateful.

Quick run down of the problem, when i goto site 2, i get the same file as for site 1. I'm sure this is something simple, but i can't seem to figure it out, so please, please, hlpe me. LOL. Without further ado...


### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs-2.0/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.

<VirtualHost *:80>
ServerAdmin webmaster@serenzia.com
DocumentRoot /var/www/html/serenzia
ServerName serenzia.com
ServerAlias www.serenzia.com
# ErrorLog logs/
# CustomLog logs/


<Directory "/var/www/html/serenzia/stuff">
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /usr/local/apache/passwd/passwords
Require user eric
</Directory>

<Directory "/var/www/html/serenzia/business">
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /usr/local/apache/passwd/passwords
Require user eddie
</Directory>


</VirtualHost>



<VirtualHost *:80>
ServerAdmin webmaster@redcore.com
DocumentRoot /var/www/html/redcore
ServerName redcoreclothing.com
ServerAlias www.redcoreclothing.com
# ErrorLog logs/
# CustomLog logs/
</VirtualHost>

I posted it ALL, but i suspect that the problem lies in my Virtual Host settings. Thanks in advance for ANYONE that is willing to lend a hand.

Edit: Couldn't post it all, it was too long. If there's another section anyone would like to see, just post and i'll throw it up here.

stefan_nicolau 06-22-2005 04:38 AM

I'm not sure, but:
A) Make sure you are using an HTTP/1.1 Browser
B) The first defined virtual host is the default, it may help
C) Try httpd -S and httpd -t to chech the configuration file and parse the settings.

Satriani 06-22-2005 06:45 AM

Not completey sure, but i think you do not need the *:80 in the NameVirtualHost directive, only the * .
Of course you will need to add it in the <VirtualHost *:80> to prevent SSL errors...

Vito_Corleone 06-22-2005 12:59 PM

Wow. Not much going on in here. Thanks for your help, to the people above me, nothing so far though. I've made some changes, here's what it's looking like now. Still the same issue though, site one seems to be taking precedence over 2.

### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs-2.0/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost www.serenzia.com
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.

<VirtualHost www.serenzia.com>
ServerAdmin webmaster@serenzia.com
DocumentRoot "/var/www/html/serenzia"
ServerName serenzia.com
ServerAlias www.serenzia.com
# ErrorLog logs/
# CustomLog logs/


<Directory "/var/www/html/serenzia/stuff">
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /usr/local/apache/passwd/passwords
Require user eric
</Directory>

<Directory "/var/www/html/serenzia/business">
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /usr/local/apache/passwd/passwords
Require user eddie
</Directory>


</VirtualHost>

NameVirtualHost www.redcoreclothing.com


<VirtualHost www.redcoreclothing.com>
ServerAdmin webmaster@redcore.com
DocumentRoot "/var/www/html/redcore"
ServerName redcoreclothing.com
ServerAlias www.redcoreclothing.com
# ErrorLog logs/
# CustomLog logs/


<Directory "/var/www/html/redcore/">

#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs-2.0/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

</Directory>

<Directory "/var/www/html/redcore/bs">
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /usr/local/apache/passwd/passwords
Require user red
</Directory>


</VirtualHost>


Is anyone around here familiar with this, or am i just kind of taking a shot in the dark?

stefan_nicolau 06-22-2005 02:37 PM

What is the output of httpd -S and httpd -t ?

RandomLinuxNewb 06-22-2005 04:10 PM

I think your problem is
Code:

NameVirtualHost www.serenzia.com
Change that to
Code:

NameVirtualHost *

stefan_nicolau 06-22-2005 04:30 PM

RandomLinuxNewb is right, but that directive was ok in the original file you posted, why have you changed it?

Vito_Corleone 06-22-2005 05:27 PM

I changed it because the examples i've seen were showing that it should look like that. I've tried it a BUNCH of different ways and nothing appears to work.

I am unable to post the httpd -S or -t results as i'm at work right now. As soon as i get a free minute, i'll log in and post it for you guys. Thanks for all of your help so far.

Satriani 06-23-2005 03:25 AM

Try this:

Code:

NameVirtualHost *

<Virtualhost *:80>
ServerName www.serenzia.com
    ...
    ...
</Virtualhost>

<Virtualhost *:80>
ServerName redcoreclothing.com>
    ...
    ...
</Virtualhost>

This should work...

stefan_nicolau 06-23-2005 04:49 AM

What is different from the original configuration?
I don't think 'Listen 80 ... NameVirtualHost *' is any different from 'NameVirtualHost *:80'
Is the > in redcoreclothing.com> a typo?

Satriani 06-23-2005 09:00 AM

Sorry , my boo... typo indeed that >
The difference is, that when you use SSL and virtualhosting, you get to have two different points: Namebased virtual hosting, and portnumbers...
So, NamevirtualHost * just means use namebased virtual hosts.

Specify the portnumber in the different VirtualHosts, like

<VirtualHost *:80> or <VirtualHost *:443>

Another thing that Might be of influence, although I am not completely sure, is UseCanonicalNames. You could try to set this Directive to Off, see if that will solve it...


All times are GMT -5. The time now is 06:08 AM.