Apache und die vhost

Apache, Lighttpd, nginx, Cherokee
jordan
Posts: 4
Joined: 2007-10-15 15:03

Apache und die vhost

Post by jordan » 2007-10-18 10:34

Hallo,

ich habe hier einen Apache, auf dem das otrs-Ticketsystem laufen soll.
Leider klappt es nicht so, wie ich es gern hätte...
Ich habe hier nun soviel rumgefummelt an der ganzen konfig, dass nun alles irgendwie total confused ist.
Ok was möchte ich erreichen:
die otrs-Hauptseite (index.pl) soll über eine Webseite erreichbar sein : otrs.meineDomain.de
die customer-Seite (customer.pl, liegt direkt unter dem Hauptordner) soll über eine andere Seite erreichbar sein: kunden.meineDomain.de
beide Seiten haben einen A-Record auf meinen Apache.
Ich habe 2 vhost-Dateien angelegt:
1) <VirtualHost 192.168.3.2:80>
ServerName otrs.meinDomain.de
ServerAdmin webmaster@meineDomain.de
DocumentRoot /usr/share/otrs/
ErrorLog /var/log/apache2/otrs_error.log
LogLevel warn
CustomLog /var/log/apache2/otrs_access.log combined
ServerSignature On
Alias /otrs-web/ "/usr/share/otrs/var/httpd/htdocs/"
ScriptAlias /otrs/ "/usr/share/otrs/bin/cgi-bin/"
ScriptAlias / "/usr/share/otrs/bin/cgi-bin/"
<Directory "/usr/share/otrs/bin/cgi-bin">
ErrorDocument 403 /index.pl
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
DirectoryIndex index.pl
</Directory>

<Directory "/usr/share/otrs/var/httpd/htdocs/">
AllowOverride None
Order allow,deny
Allow from all
/Directory>

</VirtualHost>

2) <VirtualHost 192.168.3.3:80>
ServerName kunden.meineDomain.de
ServerAdmin webmaster@meineDomain.de
DocumentRoot /usr/share/otrs/
ErrorLog /var/log/apache2/otrs_error.log
LogLevel warn
CustomLog /var/log/apache2/otrs_access.log combined
ServerSignature On
ScriptAlias /otrs/ "usr/share/otrs/bin/cgi-bin/"
ScriptAlias / "usr/share/otrs/bin/cgi-bin/"
Redirect / http://kunden.meineDomain/otrs/customer.pl
<Location /otrs>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Location>
</VirtualHost>

DIe IP-Adressen entstehen aus der 3 virtuellen Netzwerkkarten eth0:1 etc.
Ok so weit so gut.
Allerdings wenn ich nun die Webseiten von außen aufrufe, bekomme ich immer die Startseite des normalen Logins zu sehen. Der Redirect funktioniert also nicht.
Wenn ich von einem anderem Rechner im LAN eingebe:
http://192.168.3.3 kommt: Die Seite kann nicht angezeigt werden.
wenn ich von einem anderem Rechner im LAN eingebe:
http://192.168.3.2 kommt wieder die "normale" Startseite von otrs, was ja hier auch richtig ist.

Nun ist es aber leider so, dass unsere andere Webseite webmail.meineDomain.de nun auch auf die OTRS-Startseite weitergeleitet wird und nicht mehr an unseren Mailserver im internen LAN. Irgendwie reißt sich otrs nun alle webseiten unter den Nagel *grmpf*

Kommt noch jemand mit?? :lol:
Besser kann ich es leider nicht erklären. Hat jemand trotzdem eine Idee???

Danke und Gruß,
Jordan

User avatar
Joe User
Project Manager
Project Manager
Posts: 11139
Joined: 2003-02-27 01:00
Location: Hamburg

Re: Apache und die vhost

Post by Joe User » 2007-10-18 11:08

Der Redirect kann nicht funktionieren, da er einen Loop verursacht, hier muss mod_rewrite ran. Lege bitte die vollständige Apache-Config zum Download bereit, da scheint noch mehr fehlerhaft/suboptimal zu sein...

jordan
Posts: 4
Joined: 2007-10-15 15:03

Re: Apache und die vhost

Post by jordan » 2007-10-18 12:46

so, hatte in der Zwischenzeit noch mal weiter versucht und habe nun folgendes:
wenn ich hier intern http://192.168.3.3 eingebe, dann funktioniert es:
er leitet dann auf http://kunden.meineDomain.de/customer.pl weiter.
Aber wenn ich die Webseite direkt eingebe: kunden.meineDomain.de dann funktioniert der Redirekt nicht und ich lande wieder auf der normalen index.pl

Hier meine aktuellen configs:
1) unter /etc/apache2/conf.d hat sich otrs eine eigene conf angelegt:

Code: Select all

ScriptAlias /otrs/ "/usr/share/otrs/bin/cgi-bin/"
Alias /otrs-web/ "/usr/share/otrs/var/httpd/htdocs/"

<IfModule mod_perl.c>
  # load all otrs modules
  Perlrequire /usr/share/otrs/scripts/apache2-perl-startup.pl

  # Apache::Reload - Reload Perl Modules when Changed on Disk
  PerlModule Apache2::Reload
  PerlInitHandler Apache2::Reload
  PerlModule Apache2::RequestRec
</IfModule>

# set mod_perl2 options
<Location /otrs>
  ErrorDocument 403 /otrs/customer.pl
  ErrorDocument 404 /otrs/customer.pl
  AllowOverride None
  ErrorDocument 403 /otrs/index.pl
  ErrorDocument 404 /otrs/index.pl
  Options +ExecCGI
  Order allow,deny
  Allow from all

  <IfModule mod_perl.c>
    SetHandler  perl-script
    PerlResponseHandler ModPerl::Registry
    PerlOptions +ParseHeaders
    PerlOptions +SetupEnv
  </IfModule>

  <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond /var/lib/otrs/httpd/htdocs/maintainance.html -l
    RewriteRule ^.*$ /otrs-web/maintainance.html
  </IfModule>
</Location>

# directory settings
<Directory "/usr/share/otrs/bin/cgi-bin/">
    AllowOverride None
    Options +ExecCGI -Includes
    Order allow,deny
    Allow from all
</Directory>
<Directory "/usr/share/otrs/var/httpd/htdocs/">
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

# MaxRequestsPerChild (so no apache child will be to big!)
MaxRequestsPerChild 400


2) /etc/sites-enabled/kunden

Code: Select all

<VirtualHost 192.168.3.3:80>
   ServerName kunden.meineDomain.de
     ServerAdmin webmaster@meineDomain.de
   DocumentRoot /usr/share/otrs/
     ErrorLog /var/log/apache2/otrs_error.log
   LogLevel warn
    CustomLog /var/log/apache2/otrs_access.log combined
   ServerSignature On
   ScriptAlias /otrs/ "usr/share/otrs/bin/cgi-bin/"
   ScriptAlias / "usr/share/otrs/bin/cgi-bin/"
   Redirect / http://kunden.meineDomain.de/customer.pl
</VirtualHost>


3) /etc/sites-enabled/otrs

Code: Select all

<VirtualHost 192.168.3.2:80>
   ServerName otrs.meineDomain.de
     ServerAdmin webmaster@meineDomain.de
   DocumentRoot /usr/share/otrs/
     ErrorLog /var/log/apache2/otrs_error.log
   LogLevel warn
    CustomLog /var/log/apache2/otrs_access.log combined
   ServerSignature On

  Alias /otrs-web/ "/usr/share/otrs/var/httpd/htdocs/"
  ScriptAlias /otrs/ "/usr/share/otrs/bin/cgi-bin/"
  ScriptAlias / "/usr/share/otrs/bin/cgi-bin/"

  <Directory "/usr/share/otrs/bin/cgi-bin">
    ErrorDocument 403 /index.pl
    AllowOverride None
    Options +ExecCGI -Includes
    Order allow,deny
    Allow from all
    DirectoryIndex index.pl
  </Directory>

  <Directory "/usr/share/otrs/var/httpd/htdocs/">
    AllowOverride None
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>


Die apache2.conf ist noch default, soweit ich weiß:

Code: Select all

...

### Section 1: Global Environment
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
ServerRoot "/etc/apache2"
#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
LockFile /var/lock/apache2/accept.lock
#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
PidFile /var/run/apache2.pid

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
#
MaxKeepAliveRequests 100

#
#
KeepAliveTimeout 15

# prefork MPM
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

# worker MPM
<IfModule mpm_worker_module>
    StartServers          2
    MaxClients          150
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadsPerChild      25
    MaxRequestsPerChild   0
</IfModule>

User www-data
Group www-data

#AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ~ "^.ht">
    Order allow,deny
    Deny from all
</Files>

TypesConfig /etc/mime.types

#
DefaultType text/plain
#
HostnameLookups Off

#
ErrorLog /var/log/apache2/error.log
#
LogLevel warn

# Include module configuration:
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf

# Include all the user configurations:
Include /etc/apache2/httpd.conf

# Include ports listing
Include /etc/apache2/ports.conf

# Include generic snippets of statements
Include /etc/apache2/conf.d/

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
LogFormat "%h %l %u %t "%r" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

#
#
ServerTokens Full

#
#
ServerSignature On

<IfModule alias_module>
    #
    #
    Alias /icons/ "/usr/share/apache2/icons/"

    <Directory "/usr/share/apache2/icons">
        Options Indexes MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

</IfModule>

#
# Directives controlling the display of server-generated directory listings.
#
<IfModule mod_autoindex.c>
    #
    IndexOptions FancyIndexing VersionSort HTMLTable NameWidth=*
    #
    AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

    AddIconByType (TXT,/icons/text.gif) text/*
    AddIconByType (IMG,/icons/image2.gif) image/*
    AddIconByType (SND,/icons/sound2.gif) audio/*
    AddIconByType (VID,/icons/movie.gif) video/*

    AddIcon /icons/binary.gif .bin .exe
    AddIcon /icons/binhex.gif .hqx
    AddIcon /icons/tar.gif .tar
    AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
    AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
    AddIcon /icons/a.gif .ps .ai .eps
    AddIcon /icons/layout.gif .html .shtml .htm .pdf
    AddIcon /icons/text.gif .txt
    AddIcon /icons/c.gif .c
    AddIcon /icons/p.gif .pl .py
    AddIcon /icons/f.gif .for
    AddIcon /icons/dvi.gif .dvi
    AddIcon /icons/uuencoded.gif .uu
    AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
    AddIcon /icons/tex.gif .tex
    AddIcon /icons/bomb.gif core

    AddIcon /icons/back.gif ..
    AddIcon /icons/hand.right.gif README
    AddIcon /icons/folder.gif ^^DIRECTORY^^
    AddIcon /icons/blank.gif ^^BLANKICON^^

    #
    # DefaultIcon is which icon to show for files which do not have an icon
    # explicitly set.
    #
    DefaultIcon /icons/unknown.gif

    #
    # ReadmeName is the name of the README file the server will look for by
    # default, and append to directory listings.
    #
    # HeaderName is the name of a file which should be prepended to
    # directory indexes.
    ReadmeName README.html
    HeaderName HEADER.html

    #
    #
    IndexIgnore .??* *~ *# RCS CVS *,v *,t
</IfModule>

<IfModule mod_mime.c>

    #
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    #
    AddLanguage ca .ca
    AddLanguage cs .cz .cs
    AddLanguage da .dk
    AddLanguage de .de
    AddLanguage el .el
    AddLanguage en .en
    AddLanguage eo .eo
    AddLanguage es .es
    AddLanguage et .et
    AddLanguage fr .fr
    AddLanguage he .he
    AddLanguage hr .hr
    AddLanguage it .it
    AddLanguage ja .ja
    AddLanguage ko .ko
    AddLanguage ltz .ltz
    AddLanguage nl .nl
    AddLanguage nn .nn
    AddLanguage no .no
    AddLanguage pl .po
    AddLanguage pt .pt
    AddLanguage pt-BR .pt-br
    AddLanguage ru .ru
    AddLanguage sv .sv
    AddLanguage zh-CN .zh-cn
    AddLanguage zh-TW .zh-tw
</IfModule>

<IfModule mod_negotiation.c>
    #
    # LanguagePriority allows you to give precedence to some languages
    # in case of a tie during content negotiation.
    #
    # Just list the languages in decreasing order of preference. We have
    # more or less alphabetized them here. You probably want to change this.
    #
    LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW

    #
    # ForceLanguagePriority allows you to serve a result page rather than
    # MULTIPLE CHOICES (Prefer) [in case of a tie] or NOT ACCEPTABLE (Fallback)
    # [in case no accepted languages matched the available variants]
    #
    ForceLanguagePriority Prefer Fallback

</IfModule>

<IfModule mod_mime.c>
    #
    #
    AddCharset us-ascii    .ascii .us-ascii
    AddCharset ISO-8859-1  .iso8859-1  .latin1
    AddCharset ISO-8859-2  .iso8859-2  .latin2 .cen
    AddCharset ISO-8859-3  .iso8859-3  .latin3
    AddCharset ISO-8859-4  .iso8859-4  .latin4
    AddCharset ISO-8859-5  .iso8859-5  .cyr .iso-ru
    AddCharset ISO-8859-6  .iso8859-6  .arb .arabic
    AddCharset ISO-8859-7  .iso8859-7  .grk .greek
    AddCharset ISO-8859-8  .iso8859-8  .heb .hebrew
    AddCharset ISO-8859-9  .iso8859-9  .latin5 .trk
    AddCharset ISO-8859-10  .iso8859-10  .latin6
    AddCharset ISO-8859-13  .iso8859-13
    AddCharset ISO-8859-14  .iso8859-14  .latin8
    AddCharset ISO-8859-15  .iso8859-15  .latin9
    AddCharset ISO-8859-16  .iso8859-16  .latin10
    AddCharset ISO-2022-JP .iso2022-jp .jis
    AddCharset ISO-2022-KR .iso2022-kr .kis
    AddCharset ISO-2022-CN .iso2022-cn .cis
    AddCharset Big5        .Big5       .big5 .b5
    AddCharset cn-Big5     .cn-big5
    # For russian, more than one charset is used (depends on client, mostly):
    AddCharset WINDOWS-1251 .cp-1251   .win-1251
    AddCharset CP866       .cp866
    AddCharset KOI8      .koi8
    AddCharset KOI8-E      .koi8-e
    AddCharset KOI8-r      .koi8-r .koi8-ru
    AddCharset KOI8-U      .koi8-u
    AddCharset KOI8-ru     .koi8-uk .ua
    AddCharset ISO-10646-UCS-2 .ucs2
    AddCharset ISO-10646-UCS-4 .ucs4
    AddCharset UTF-7       .utf7
    AddCharset UTF-8       .utf8
    AddCharset UTF-16      .utf16
    AddCharset UTF-16BE    .utf16be
    AddCharset UTF-16LE    .utf16le
    AddCharset UTF-32      .utf32
    AddCharset UTF-32BE    .utf32be
    AddCharset UTF-32LE    .utf32le
    AddCharset euc-cn      .euc-cn
    AddCharset euc-gb      .euc-gb
    AddCharset euc-jp      .euc-jp
    AddCharset euc-kr      .euc-kr
    #Not sure how euc-tw got in - IANA doesn't list it???
    AddCharset EUC-TW      .euc-tw
    AddCharset gb2312      .gb2312 .gb
    AddCharset iso-10646-ucs-2 .ucs-2 .iso-10646-ucs-2
    AddCharset iso-10646-ucs-4 .ucs-4 .iso-10646-ucs-4
    AddCharset shift_jis   .shift_jis .sjis

    #
    # For type maps (negotiated resources):
    # (This is enabled by default to allow the Apache "It Worked" page
    #  to be distributed in multiple languages.)
    #
    AddHandler type-map var

    #
    #
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IfModule>

<IfModule mod_setenvif.c>
    #
    # The following directives modify normal HTTP response behavior to
    # handle known problems with browser implementations.
    #
    BrowserMatch "Mozilla/2" nokeepalive
    BrowserMatch "MSIE 4.0b2;" nokeepalive downgrade-1.0 force-response-1.0
    BrowserMatch "RealPlayer 4.0" force-response-1.0
    BrowserMatch "Java/1.0" force-response-1.0
    BrowserMatch "JDK/1.0" force-response-1.0

    #
    BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
    BrowserMatch "MS FrontPage" redirect-carefully
    BrowserMatch "^WebDrive" redirect-carefully
    BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
    BrowserMatch "^gnome-vfs/1.0" redirect-carefully
    BrowserMatch "^XML Spy" redirect-carefully
    BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
</IfModule>

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/


Vielen Dank!!