[SOLVED] Apache2 2.4.10 - Kein Rewrite möglich

Debian macht sich hervorragend als Web- und Mailserver. Schau auch in den " Tipps und Tricks"-Bereich.
Antworten
Saxenpower

[SOLVED] Apache2 2.4.10 - Kein Rewrite möglich

Beitrag von Saxenpower » 02.12.2015 17:51:34

Hallo,

ich habe seit dem Upgrade von Apache 2.2 auf Apache 2.4 meine Probleme mit dem Rewrite von URLs. Ich habe hier zwei virtuelle Server "www.ersatzdomain.com" und "www.ersatzdomain.eu" (Aus datenschutzrechtlichen Gründen nur diese Fantasienamen). Wobei der Aufruf von http://www.ersatzdomain.eu im Browser auf http://www.ersatzdomain.com forwarden soll. Bzw. zeigen die Configs ja auch, dass letztendlich auf "https://www.ersatzdomain.com" rewrited werden soll.
Das hatte bisher unter Apache 2.2 ganz prima funktioniert.

Code: Alles auswählen

<VirtualHost 192.168.1.7:80>
        ServerAdmin hostmaster@ersatzdomain.eu
        DocumentRoot /srv/www/typo3cms/ersatzdomain.eu
        ServerName www.ersatzdomain.eu
        ServerAlias ersatzdomain.eu

        <Directory /srv/www/typo3cms/ersatzdomain.com/>
                Options +Indexes +FollowSymLinks +MultiViews
                AllowOverride All
                Require all granted
        </Directory>

        ServerSignature On

        RewriteEngine on
        RewriteCond %{HTTP_HOST} ^www.ersatzdomain.eu$ [NC]
        RewriteRule ^(.*) https://www.ersatzdomain.com$1 [L,R=301]
        RewriteCond %{HTTP_HOST} ^ersatzdomain.eu$ [NC]
        RewriteRule ^(.*) https://www.ersatzdomain.com$1 [L,R=301]
</VirtualHost>

Code: Alles auswählen

<VirtualHost 192.168.1.7:80>
        ServerAdmin hostmaster@ersatzdomain.com
        DocumentRoot /srv/www/typo3cms/ersatzdomain.com
        ServerName www.ersatzdomain.com
        ServerAlias ersatzdomain.com

        <Directory /srv/www/typo3cms/ersatzdomain.com/>
                Options +Indexes +FollowSymLinks +MultiViews
                AllowOverride All
                Require all granted
        </Directory>

        ScriptAlias /scripts "/srv/www/typo3cms/ersatzdomain.com/scripts/"

        <Directory "/srv/www/typo3cms/ersatzdomain.com/scripts/">
                AllowOverride All
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Require all granted
         </Directory>

        Alias /Admin "/srv/www/typo3cms/ersatzdomain.com/typo3/"

        <Directory "/srv/www/typo3cms/ersatzdomain.com/typo3/">
                Options -Indexes +MultiViews +FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>

        ScriptAlias /cgi-bin/ "/srv/www/typo3cms/ersatzdomain.com/cgi-bin/"

        <Directory "/srv/www/typo3cms/ersatzdomain.com/cgi-bin/">
                AllowOverride None
                Options +ExecCGI
                AddHandler cgi-script .cgi .pl
                Require all granted
        </Directory>

        ErrorLog /var/log/apache2/www.ersatzdomain.com-error.log

        LogLevel warn

        CustomLog /var/log/apache2/www.ersatzdomain.com-access.log combined
        ServerSignature On

        RewriteEngine on
        LogLevel  alert rewrite:trace3
        RewriteCond %{HTTP_HOST} ^www.ersatzdomain.com$ [NC]
        RewriteRule ^(.*) https://www.ersatzdomain.com$1 [L,R=301]
        RewriteCond %{HTTP_HOST} ^ersatzdomain.com$ [NC]
        RewriteRule ^(.*) https://ersatzdomain.com$1 [L,R=301]

</VirtualHost>

# StartSSL:
<VirtualHost *:443>
        ServerName www.ersatzdomain.com
        DocumentRoot /srv/www/typo3cms/ersatzdomain.com

        <Directory /srv/www/typo3cms/ersatzdomain.com/>
                Options +Indexes +FollowSymLinks +MultiViews
                AllowOverride All
                Require all granted
        </Directory>

        SSLEngine on
        SSLProtocol all -SSLv2
        SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
        SSLCertificateFile /etc/startssl/ersatzdomain.com/ersatzdomain.com.crt
        SSLCertificateKeyFile /etc/startssl/ersatzdomain.com/ersatzdomain.com.key
        SSLCertificateChainFile /etc/startssl/sub.class1.server.ca.pem
        SSLCACertificateFile /etc/startssl/ca.pem
</VirtualHost>
Wenn ich im Browser "https://www.ersatzdomain.com" aufrufe, dann wird mir die Website angezeigt. "http://www.ersatzdomain.com" oder ""http://www.ersatzdomain.eu" liefert im Error-Logfile die Meldung
[Wed Dec 02 17:44:28.437429 2015] [authz_core:error] [pid 24970] [client 93.231.150.22:36620] AH01630: client denied by server configuration: /srv/www/typo3cms/
bzw. im Access-Logfile
93.231.150.22 - - [02/Dec/2015:17:47:46 +0100] "GET / HTTP/1.1" 403 512 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:44.0) Gecko/20100101 Firefox/44.0"

Code: Alles auswählen

apache2ctl -t -D DUMP_MODULES
[Wed Dec 02 17:49:56.302630 2015] [core:error] [pid 25496] (EAI 2)Name or service not known: AH00547: Could not resolve host name + -- ignoring!
Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 fcgid_module (shared)
 filter_module (shared)
 mime_module (shared)
 mpm_prefork_module (shared)
 negotiation_module (shared)
 php5_module (shared)
 proxy_module (shared)
 proxy_http_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 socache_shmcb_module (shared)
 ssl_module (shared)
 status_module (shared)
Was mache ich falsch, dass rewrite nicht mehr funktioniert?

Grüße
SaxenPower
Zuletzt geändert von Saxenpower am 11.12.2015 10:40:48, insgesamt 1-mal geändert.

Dimejo
Beiträge: 503
Registriert: 21.07.2014 13:37:23

Re: Apache2 2.4.10 - Kein Rewrite möglich

Beitrag von Dimejo » 04.12.2015 21:13:56

Versuche es mal mit Allow from all.

Saxenpower

Re: Apache2 2.4.10 - Kein Rewrite möglich

Beitrag von Saxenpower » 07.12.2015 10:16:45

Dimejo hat geschrieben:Versuche es mal mit Allow from all.
Das hilft leider absolut nichts.

Code: Alles auswählen

[Mon Dec 07 10:13:56.807245 2015] [authz_core:error] [pid 17320] [client 93.193.101.183:49668] AH01630: client denied by server configuration: /srv/www/typo3cms/
Ausserdem sollte doch in Apache 2.4.10
Order allow,deny Allow from durch Require all grante ersetzt werden.

uname
Beiträge: 12539
Registriert: 03.06.2008 09:33:02

Re: Apache2 2.4.10 - Kein Rewrite möglich

Beitrag von uname » 07.12.2015 14:23:02

Die Fehlermeldung sagt eigentlich nichts von Rewrite, sondern ein generelles Zugriffsproblem.

Der Eintrag sollte ungefähr so aussehen. Hast du Apache2 neu restartet?

Code: Alles auswählen

<Directory /srv/www/typo3cms>
  Order allow,deny
  Allow from all
</Directory>
Ausserdem sollte doch in Apache 2.4.10
Order allow,deny Allow from durch Require all grante ersetzt werden.
Dazu kann ich leider nichts sagen. Vielleicht weiß jemand mehr. Wäre sowas nicht abwärtskompatibel?

Saxenpower

Re: Apache2 2.4.10 - Kein Rewrite möglich

Beitrag von Saxenpower » 07.12.2015 14:50:43

uname hat geschrieben:Die Fehlermeldung sagt eigentlich nichts von Rewrite, sondern ein generelles Zugriffsproblem.

Der Eintrag sollte ungefähr so aussehen. Hast du Apache2 neu restartet?

Code: Alles auswählen

<Directory /srv/www/typo3cms>
  Order allow,deny
  Allow from all
</Directory>
Ausserdem sollte doch in Apache 2.4.10
Order allow,deny Allow from durch Require all grante ersetzt werden.
Dazu kann ich leider nichts sagen. Vielleicht weiß jemand mehr. Wäre sowas nicht abwärtskompatibel?
https://httpd.apache.org/docs/2.4/upgrading.html

Benutzeravatar
4A4B
Beiträge: 981
Registriert: 09.11.2011 11:19:55
Kontaktdaten:

Re: Apache2 2.4.10 - Kein Rewrite möglich

Beitrag von 4A4B » 07.12.2015 15:09:41

Tippfehler bei der Übertragung? Hier leistest du die Domains auf sich selbst weiter:

Code: Alles auswählen

        RewriteCond %{HTTP_HOST} ^www.ersatzdomain.com$ [NC]
        RewriteRule ^(.*) https://www.ersatzdomain.com$1 [L,R=301]
        RewriteCond %{HTTP_HOST} ^ersatzdomain.com$ [NC]
        RewriteRule ^(.*) https://ersatzdomain.com$1 [L,R=301]
[Wed Dec 02 17:44:28.437429 2015] [authz_core:error] [pid 24970] [client 93.231.150.22:36620] AH01630: client denied by server configuration: /srv/www/typo3cms/
Der in der Fehlermeldung angesprochene Pfad /srv/www/typo3cms/ liegt außerhalb der erlaubten Verzeichnisse:

Code: Alles auswählen

        <Directory /srv/www/typo3cms/ersatzdomain.com/>
                Options +Indexes +FollowSymLinks +MultiViews
                AllowOverride All
                Require all granted
        </Directory>
Allerdings stellt sich hier die Frage, wie der Webserver darauf kommt, denn DocumentRoot ist ja entsprechend angegeben:

Code: Alles auswählen

     DocumentRoot /srv/www/typo3cms/ersatzdomain.com

Antworten