PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : httpd.conf leitet Anfragen nicht mehr in das passende Webverzeichnis



marcjoerg
16.03.10, 13:49
Hallo zusammen,

mein Linux-Server war mit eth0 an die Außenwelt (Kabelmodem) und über eth1 (auf WLAN-Router) in die Innenwelt angebunden.
Ich hatte mehrere Websieiten (www.erstewebsite.de; www.zweitewebsite.de, ...) laufen, welche auch alle über httpd.conf in die richtigen Verzeichnisse (/srv/www/htdocs/erstewebsite; /srv/www/htdocs/zweitewebsite) geleitet wurden.

Nun habe ich die Linuxkiste von der direkten Außenwelt abgekoppelt und hinter den WLAN-Router (FritzBox) über eth0 angeschlossen. Der Server verteilt nun nicht mehr selbst die IP-Adressen, sondern bekommt über die FritzBox eine IP zugeteilt. SOnst habe ich nichts geändert.

Wenn ich jetzt www.erstewebsite.de eingebe, dann werde ich nicht mehr in die richtigen Verzeichnisse geleitet, sondern komme auf /srv/www/htdocs raus. D.h. auch wenn ich www.zweitewebsite.de eingebe, komme ich auf /srv/www/htdocs raus.

Was mache ich falsch, bzw. was muss ich ändern??

Vielen Dank und Grüße
Marc

derRichard
16.03.10, 15:51
hi!

der webserver leitet keine anfragen in ein verzeichnis um...
das ist alles eine sache der vhost-konfiguration.

zeig und doch diese mal, sonst wird das nur eine raterunde...

//richard

marcjoerg
17.03.10, 19:13
Hi!

Ich mache das alles über die httpd.conf wie folgt:


### Global Environment ################################################## ####
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests.

# run under this user/group id
Include /etc/apache2/uid.conf

# - how many server processes to start (server pool regulation)
# - usage of KeepAlive
Include /etc/apache2/server-tuning.conf

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
ErrorLog /var/log/apache2/error_log

# generated from APACHE_MODULES in /etc/sysconfig/apache2
Include /etc/apache2/sysconfig.d/loadmodule.conf

# IP addresses / ports to listen on
Include /etc/apache2/listen.conf

# predefined logging formats
Include /etc/apache2/mod_log_config.conf

# generated from global settings in /etc/sysconfig/apache2
Include /etc/apache2/sysconfig.d/global.conf

# optional mod_status, mod_info
Include /etc/apache2/mod_status.conf
Include /etc/apache2/mod_info.conf

# optional cookie-based user tracking
# read the documentation before using it!!
Include /etc/apache2/mod_usertrack.conf

# configuration of server-generated directory listings
Include /etc/apache2/mod_autoindex-defaults.conf

# associate MIME types with filename extensions
TypesConfig /etc/apache2/mime.types
DefaultType text/plain
Include /etc/apache2/mod_mime-defaults.conf

# set up (customizable) error responses
Include /etc/apache2/errors.conf

# global (server-wide) SSL configuration, that is not specific to
# any virtual host
Include /etc/apache2/ssl-global.conf

# forbid access to the entire filesystem by default
<Directory />
Options None
AllowOverride All
# AllowOverride
Order deny,allow
Deny from all
</Directory>

# use .htaccess files for overriding,
AccessFileName .htaccess
# and never show them
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>

# List of resources to look for when the client requests a directory
DirectoryIndex index.html index.html.var index.php index.php4

### 'Main' server configuration #############################################
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
Include /etc/apache2/default-server.conf


# Another way to include your own files
#
# The file below is generated from /etc/sysconfig/apache2,
# include arbitrary files as named in APACHE_CONF_INCLUDE_FILES and
# APACHE_CONF_INCLUDE_DIRS
Include /etc/apache2/sysconfig.d/include.conf


### Virtual server configuration ############################################
#
# 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.
#
#Include /etc/apache2/vhosts.d/*.conf

NameVirtualHost xxx.dyndns.info:80
<VirtualHost xxx.dyndns.net:80>
ServerAdmin xxx@gmx.de
ServerName www.erstewebseite.de
DocumentRoot /srv/www/htdocs/erstewebseite
ErrorLog /srv/www/htdocs/erstewebseite/logs/error_log
CustomLog /srv/www/htdocs/erstewebseite/logs/access_log combined

<Directory /srv/www/htdocs/erstewebseite>
Options FollowSymLinks Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost xxx.dyndns.info:80>
ServerAdmin xxx@gmx.de
ServerName www.zweitewebseite.de
DocumentRoot /srv/www/htdocs/zweitewebseite
ErrorLog /srv/www/htdocs/zweitewebseite/logs/error_log
CustomLog /srv/www/htdocs/zweitewebseite/logs/access_log combined

<Directory /srv/www/htdocs/zweitewebseite>
Options FollowSymLinks Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


# Note: instead of adding your own configuration here, consider
# adding it in your own file (/etc/apache2/httpd.conf.local)
# putting its name into APACHE_CONF_INCLUDE_FILES in
# /etc/sysconfig/apache2 -- this will make system updates
# easier :)
#
# Directives to allow use of AWStats as a CGI
#
Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/local/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"
ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"

#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory "/usr/local/awstats/wwwroot">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>



Komischerweise gings vorher ja ohne Probleme...

Grüße
Marc

derRichard
17.03.10, 23:13
hi!

dein apache hört ja nur auf xxx.dyndns.info.
ich würd das durch ein "*" ersetzen.
dann ist es ihm egal, auf welche adresse die anfrage geht...

hth,
//richard

marcjoerg
18.03.10, 12:29
Hi!

Ich weiß zwar nicht warum, aber jetzt klappt es ohne Probleme.
Danke!

Gruß
Marc

derRichard
18.03.10, 13:08
Hi!

Ich weiß zwar nicht warum, aber jetzt klappt es ohne Probleme.
Danke!

Gruß
Marc
dann wirf mal einen blick in das apache manual:
http://httpd.apache.org/docs/2.2/mod/core.html#namevirtualhost

hth,
//richard