it-nachtigal
Goto Top

Apache ruft falsche Subdomain auf, statt Fehler 404 bei Schreibfehler in der Browser-Eingabezeile

Hallo, und Moin Moin aus dem Norden !

Ich habe einen Apache - Webserver laufen, der mir etwa 50 Domains und Subdomains ordentlich darstellt.
Ich habe nun das Problem, dass wenn sich jemand bei einer Subdomain verschreibt, landet er auf einer vollständig anderen Seite ! Beispiel :

ich möchte die Subdomain http://test.soundart-records.de erreichen, und schreibe aber aus versehen http://tesat.soundart-records.de,
dann bekomme ich keine Fehler 404, sondern die Seite http://immosoft.sven-arndt-immobilien.com (die auch auf meinem Server liegt.)

Kann mir bitte jemand sagen, was ich vielleicht falsch gemacht habe, oder wie ich das umgehen kann ?


Vielen Dank für eure Zeit


Andreas Nachtigal, IT-Nachtigal

Content-Key: 187679

Url: https://administrator.de/contentid/187679

Ausgedruckt am: 28.03.2024 um 17:03 Uhr

Mitglied: bytecounter
bytecounter 09.07.2012 um 14:21:40 Uhr
Goto Top
Hallo,

also man kann definieren, was der Server machen soll, wenn er eine Seite nicht findet. Das ist hier aber nicht das Problem.
Ein paar mehr Infos wären daher nicht schlecht. Wie schaut z. B. die Domainkonfiguration aus?

vg
Mitglied: it-nachtigal
it-nachtigal 09.07.2012 aktualisiert um 16:29:03 Uhr
Goto Top
Hallo Bytecounter,

folgende vhosts-Einstellung ist für die Immosoft - Seite :


<VirtualHost xx>
DocumentRoot /srv/www/Immosoft/Sven-Arndt-Immobilien.com
ServerName ImmoSoft.Sven-arndt-immobilien.com
<Directory /srv/www/Immosoft/Sven-Arndt-Immobilien.com>
allow from all
Options +Indexes
Options +FollowSymLinks
</Directory>
</VirtualHost>

folgende für die Test-Seite :

<VirtualHost xx>
DocumentRoot "/srv/www/Arndt/Soundart-Records.de"
ServerName test.soundart-records.de
<Directory "/srv/www/Arndt/Soundart-Records.de">
allow from all
Options +Indexes
Options +FollowSymLinks
</Directory>
</VirtualHost>


die httpd.conf :
#
  1. /etc/apache2/httpd.conf
#
  1. This is the main Apache server configuration file. It contains the
  2. configuration directives that give the server its instructions.
  3. See <URL:http://httpd.apache.org/docs-2.2/>; for detailed information about
  4. the directives.

  1. Based upon the default apache configuration file that ships with apache,
  2. which is based upon the NCSA server configuration files originally by Rob
  3. McCool. This file was knocked together by Peter Poeml <poeml+apache@suse.de>.

  1. If possible, avoid changes to this file. It does mainly contain Include
  2. statements and global settings that can/should be overridden in the
  3. configuration of your virtual hosts.

  1. Quickstart guide:
  2. http://en.opensuse.org/Apache_Quickstart_HOWTO


  1. Overview of include files, chronologically:
#
  1. httpd.conf
  2. |
  3. |-- uid.conf . . . . . . . . . . . . . . UserID/GroupID to run under
  4. |-- server-tuning.conf . . . . . . . . . sizing of the server (how many processes to start, ...)
  5. |-- sysconfig.d/loadmodule.conf . . . . . [*] load these modules
  6. |-- listen.conf . . . . . . . . . . . . . IP adresses / ports to listen on
  7. |-- mod_log_config.conf . . . . . . . . . define logging formats
  8. |-- sysconfig.d/global.conf . . . . . . . [*] server-wide general settings
  9. |-- mod_status.conf . . . . . . . . . . . restrict access to mod_status (server monitoring)
  10. |-- mod_info.conf . . . . . . . . . . . . restrict access to mod_info
  11. |-- mod_usertrack.conf . . . . . . . . . defaults for cookie-based user tracking
  12. |-- mod_autoindex-defaults.conf . . . . . defaults for displaying of server-generated directory listings
  13. |-- mod_mime-defaults.conf . . . . . . . defaults for mod_mime configuration
  14. |-- errors.conf . . . . . . . . . . . . . customize error responses
  15. |-- ssl-global.conf . . . . . . . . . . . SSL conf that applies to default server _and all_ virtual hosts
  16. |
  17. |-- default-server.conf . . . . . . . . . set up the default server that replies to non-virtual-host requests
  18. | |--mod_userdir.conf . . . . . . . . enable UserDir (if mod_userdir is loaded)
  19. | `--conf.d/apache2-manual?conf . . . add the docs ('?' = if installed)
  20. |
  21. |-- sysconfig.d/include.conf . . . . . . [*] your include files
  22. | (for each file to be included here, put its name
  23. | into APACHE_INCLUDE_* in /etc/sysconfig/apache2)
  24. |
  25. `-- vhosts.d/ . . . . . . . . . . . . . . for each virtual host, place one file here
  26. `-- *.conf . . . . . . . . . . . . . (*.conf is automatically included)
#
#
  1. Files marked [*] are created from sysconfig upon server restart: instead of
  2. these files, you edit /etc/sysconfig/apache2



  1. Filesystem layout:
#
  1. /etc/apache2/
  2. |-- charset.conv . . . . . . . . . . . . for mod_auth_ldap
  3. |-- conf.d/
  4. | |-- apache2-manual.conf . . . . . . . conf that comes with apache2-doc
  5. | |-- mod_php4.conf . . . . . . . . . . (example) conf that comes with apache2-mod_php4
  6. | `-- ... . . . . . . . . . . . . . . . other configuration added by packages
  7. |-- default-server.conf
  8. |-- errors.conf
  9. |-- httpd.conf . . . . . . . . . . . . . top level configuration file
  10. |-- listen.conf
  11. |-- magic
  12. |-- mime.types -> ../mime.types
  13. |-- mod_autoindex-defaults.conf
  14. |-- mod_info.conf
  15. |-- mod_log_config.conf
  16. |-- mod_mime-defaults.conf
  17. |-- mod_perl-startup.pl
  18. |-- mod_status.conf
  19. |-- mod_userdir.conf
  20. |-- mod_usertrack.conf
  21. |-- server-tuning.conf
  22. |-- ssl-global.conf
  23. |-- ssl.crl/ . . . . . . . . . . . . . . PEM-encoded X.509 Certificate Revocation Lists (CRL)
  24. |-- ssl.crt/ . . . . . . . . . . . . . . PEM-encoded X.509 Certificates
  25. |-- ssl.csr/ . . . . . . . . . . . . . . PEM-encoded X.509 Certificate Signing Requests
  26. |-- ssl.key/ . . . . . . . . . . . . . . PEM-encoded RSA Private Keys
  27. |-- ssl.prm/ . . . . . . . . . . . . . . public DSA Parameter Files
  28. |-- sysconfig.d/ . . . . . . . . . . . . files that are created from /etc/sysconfig/apache2
  29. | |-- global.conf
  30. | |-- include.conf
  31. | `-- loadmodule.conf
  32. |-- uid.conf
  33. `-- vhosts.d/ . . . . . . . . . . . . . . put your virtual host configuration (*.conf) here
  34. |-- vhost-ssl.template
  35. `-- vhost.template



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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. List of resources to look for when the client requests a directory
DirectoryIndex index.html index.html.var index.shtml index.cfm index.php index.htm

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


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


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


  1. Note: instead of adding your own configuration here, consider
  2. adding it in your own file (/etc/apache2/httpd.conf.local)
  3. putting its name into APACHE_CONF_INCLUDE_FILES in
  4. /etc/sysconfig/apache2 -- this will make system updates
  5. easier face-smile
AddOutputFilter INCLUDES .shtml
AddType text/html .shtml
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
GracefulShutDownTimeout 3
php_admin_value open_basedir /srv/www/
php_admin_value include_path .
php_value safe_mode_exec_dir /srv/www/empty/
NameVirtualHost xx

Vielen Dank für eure Mühe
Mitglied: bytecounter
bytecounter 09.07.2012 um 16:22:54 Uhr
Goto Top
Wenn man einen öffentlichen Webserver betreibt, sollte man wissen, was man tut. Dazu gehört auch, keine internen "Echtdaten", wie z. B. IP-Adressen usw. zu veröffentlichen. Solche Infos muss man vor Veröffentlichung grundsätzlich durch Platzhalter ersetzen!

Nun zu Deinem Problem:
Du nutzt namensbasierte vhosts. In diesem Fall nimmt Apache den ersten vhost, wenn er den gewünschten vhost nicht finden kann. Dies kann man mit einem zusätzliche vhost abfangen, dieser wird einfach als erster in die /etc/apache2/sites-available/000-default eingetragen und ein Link auf die Datei in sites-enabled

Dieser Default-Host gibt dann einfach eine Seite aus, dass er die URL nicht finden konnte.

vg
Mitglied: it-nachtigal
it-nachtigal 09.07.2012 um 16:53:21 Uhr
Goto Top
Hallo bytecounter,

vielen Dank für die Tipps. Die von Dir angesprochene Datei gab es leider nicht, jedoch hat mir die Erklärung der Funktionsweise weiter geholfen.
Der Fehler war folgender : Ich hatte den Namen der conf-Datei der Immosoft - Seite groß geschrieben, daher wurde er als erstes berücksichtigt. Ich habe alles auf kleine Schreibweise geändert, und schon wurde die (bereits vorhandene) aaa.vhosts als erstes aus dem vhosts - Verzeichnis genommen. ...Muss man erst mal drauf kommen.

Vielen Dank !


Andreas Nachtigal, IT-Nachtigal
Mitglied: bytecounter
bytecounter 09.07.2012 um 19:05:07 Uhr
Goto Top
Wenn das Problem gelöst ist, bitte den Beitrag auch als gelöst markieren!
Danke!