[SOLVED] Apache 2.4.10 - Kein Rewrite möglich

Alles, was den Apache betrifft, kann hier besprochen werden.

[SOLVED] Apache 2.4.10 - Kein Rewrite möglich

Postby Kenyan » 10. December 2015 17:00

Hallo,
ich habe nach wie vor das Problem, dass Rewrite nach einem Upgrade von Apache
2.2 auf 2.4.10 nicht mehr funktioniert.
Wenn ich mit den beigefügten Configs https://www.surface.com im Browser
aufrufe, besteht keinerlei Problem. Sobald ich aber http://www.surface.com oder surface.com aufrufe, sehe ich nur
den "index of" der Verzeichnisebene der Festplatte.

000-default.conf
Code: Select all
<VirtualHost 192.168.1.7:80>
        ServerAdmin hostmaster@surface.com
        DocumentRoot /srv/www/typo3cms/surface.com
        ServerName www.surface.com
        ServerAlias surface.com
        <Directory /srv/www/typo3cms/surface.com/>
                Options +Indexes +FollowSymLinks +MultiViews
                AllowOverride All
                Require all granted
                Allow from all
        </Directory>
        ScriptAlias /scripts "/srv/www/typo3cms/surface.com/scripts/"
        <Directory "/srv/www/typo3cms/surface.com/scripts/">
                AllowOverride All
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Require all granted
                Allow from all
         </Directory>
        Alias /Admin "/srv/www/typo3cms/surface.com/typo3/"
        <Directory "/srv/www/typo3cms/surface.com/typo3/">
                Options -Indexes +MultiViews +FollowSymLinks
                AllowOverride All
                Require all granted
                Allow from all
        </Directory>
        ScriptAlias /cgi-bin/ "/srv/www/typo3cms/surface.com/cgi-bin/"
        <Directory "/srv/www/typo3cms/surface.com/cgi-bin/">
                AllowOverride None
                Options +ExecCGI
                AddHandler cgi-script .cgi .pl
                Require all granted
                Allow from all
        </Directory>
        ErrorLog /var/log/apache2/www.surface.com-error.log
        LogLevel debug
        CustomLog /var/log/apache2/www.surface.com-access.log common
        ServerSignature On
        <IfModule mod_rewrite.c>
                RewriteEngine on
                LogLevel  alert rewrite:trace3
                RewriteCond %{HTTP_HOST} ^www.surface.com$ [NC]
                RewriteRule ^(.*) https://www.surface.com$1 [L,R=301]
                RewriteCond %{HTTP_HOST} ^surface.com$ [NC]
                RewriteRule ^(.*) https://surface.com$1 [L,R=301]
        </IfModule>
</VirtualHost>
<VirtualHost *:443>
        ServerName www.surface.com
        DocumentRoot /srv/www/typo3cms/surface.com
        <Directory /srv/www/typo3cms/surface.com/>
                Options +Indexes +FollowSymLinks +MultiViews
                AllowOverride All
                Require all granted
                Allow from all
        </Directory>
        ErrorLog /var/log/apache2/www.surface.com-error.log
        LogLevel debug
        CustomLog /var/log/apache2/www.surface.com-access.log common
        SSLEngine on
        SSLProtocol all -SSLv2
        SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
        SSLCertificateFile /etc/startssl/surface.com/surface.com.crt
        SSLCertificateKeyFile /etc/startssl/apache_server.key
</VirtualHost>

apache2.conf
Code: Select all
Mutex file:${APACHE_LOCK_DIR} default
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel debug
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>
<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>
<Directory /srv/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
        Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf


Module

Code: Select all
apache2ctl -M
[Thu Dec 10 16:57:51.405376 2015] [core:error] [pid 4952] (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)


Wenn ich die URL ohne "https://" aufrufe stehen in der error.log diese Einträge:
Code: Select all
[Thu Dec 10 16:48:23.070986 2015] [authz_core:debug] [pid 4860] mod_authz_core.c(809): [client 94.224.187.102:38645] AH01626: authorization result of Require all granted: granted
[Thu Dec 10 16:48:23.070992 2015] [authz_core:debug] [pid 4860] mod_authz_core.c(809): [client 94.224.187.102:38645] AH01626: authorization result of <RequireAny>: granted
[Thu Dec 10 16:48:23.071075 2015] [authz_core:debug] [pid 4860] mod_authz_core.c(809): [client 94.224.187.102:38645] AH01626: authorization result of Require all granted: granted
[Thu Dec 10 16:48:23.071083 2015] [authz_core:debug] [pid 4860] mod_authz_core.c(809): [client 94.224.187.102:38645] AH01626: authorization result of <RequireAny>: granted
[Thu Dec 10 16:48:23.071176 2015] [deflate:debug] [pid 4860] mod_deflate.c(855): [client 94.224.187.102:38645] AH01384: Zlib: Compressed 2460 to 547 : URL /


Vielleicht übersehe ich einen Konfigurationsfehler oder mache etwas Anderes falsch. Kann mir hier jemand weiterhelfen?

Grüße

Kenyan
Last edited by Kenyan on 11. December 2015 08:38, edited 1 time in total.
Kenyan
 
Posts: 3
Joined: 10. December 2015 16:41
Operating System: Debian 8, Apache 2.4.10

Re: Apache 2.4.10 - Kein Rewrite möglich

Postby Melewo » 10. December 2015 19:17

Kenne mich jetzt nur mit einer htaccess innerhalb von Webspaces aus und nicht allgemein mit der Serverkonfiguration, so weiß ich nicht, ob da noch mehr Fehler enthalten sind. Was ich aber für fehlerhaft halten würde:

Kenyan wrote:
Code: Select all
                RewriteCond %{HTTP_HOST} ^www.surface.com$ [NC]
                RewriteRule ^(.*) https://www.surface.com$1 [L,R=301]
                RewriteCond %{HTTP_HOST} ^surface.com$ [NC]
                RewriteRule ^(.*) https://surface.com$1 [L,R=301]


Da fehlt doch wohl minimal ein Slash vor $1.

Code: Select all
                RewriteCond %{HTTP_HOST} ^www\.surface\.com$ [NC]
                RewriteRule ^(.*) https://www.surface.com/$1 [L,R=301]
                RewriteCond %{HTTP_HOST} ^surface\.com$ [NC]
                RewriteRule ^(.*) https://surface.com/$1 [L,R=301]

Und dann würde ich mit den Konditionen auf eine Endlosschleife tippen. Wenn "http://www.surface.com" dann leite auf "https://www.surface.com" und das ohne Abfrage, ob bereits https:// ist? Könnte jetzt sein, dass ich da einen Denkfehler habe, doch in einer htaccess würde ich eine der beiden Varianten wählen:

Code: Select all
                RewriteCond %{SERVER_PORT} !^443$
                RewriteCond %{HTTP_HOST} ^www\.surface\.com$ [NC]
                RewriteRule ^(.*) https://www.surface.com/$1 [L,R=301]
                RewriteCond %{SERVER_PORT} !^443$
                RewriteCond %{HTTP_HOST} ^surface\.com$ [NC]
                RewriteRule ^(.*) https://surface.com/$1 [L,R=301]

Wenn noch nicht ! Port 443, dann leite weiter auf https.

Oder wenn https noch off, dann leite weiter auf https:

Code: Select all
                RewriteCond %{HTTPS} off
                RewriteCond %{HTTP_HOST} ^www\.surface\.com$ [NC]
                RewriteRule ^(.*) https://www.surface.com/$1 [L,R=301]
                RewriteCond %{HTTPS} off
                RewriteCond %{HTTP_HOST} ^surface\.com$ [NC]
                RewriteRule ^(.*) https://surface.com/$1 [L,R=301]

Wobei ich mich aber gleich für eine Variante mit oder ohne www entscheiden würde, um eine Standard-Domain zu definieren.
Melewo
 
Posts: 15
Joined: 08. August 2015 20:35
Operating System: Windows 10

Re: Apache 2.4.10 - Kein Rewrite möglich

Postby Nobbie » 10. December 2015 19:41

Kenyan wrote:dass Rewrite nach einem Upgrade von Apache
2.2 auf 2.4.10 nicht mehr funktioniert.


Dann würde ich wieder zurück gehen auf Apache 2.2. Da läuft es doch. Und dann kannst Du in Ruhe auf einer Testumgebung schauen, wie Du die Anwendung auf Apache 2.4 portierst. Das ist von hier aus für uns noch viel schwerer zu debuggen als für Dich. Ungleich schwerer.
Nobbie
 
Posts: 13176
Joined: 09. March 2008 13:04

Re: Apache 2.4.10 - Kein Rewrite möglich

Postby Kenyan » 11. December 2015 08:15

Nobbie wrote:Dann würde ich wieder zurück gehen auf Apache 2.2. Da läuft es doch. Und dann kannst Du in Ruhe auf einer Testumgebung schauen, wie Du die Anwendung auf Apache 2.4 portierst. Das ist von hier aus für uns noch viel schwerer zu debuggen als für Dich. Ungleich schwerer.

Schlechter Witz. Dann läuft die Software nicht, die die Upgrades erforderlich gemacht hatte. Es hat schon seinen Grund, warum das System-Upgrade notwendig war. Das Apache-Upgrade war eher das Nebenprodukt.
Kenyan
 
Posts: 3
Joined: 10. December 2015 16:41
Operating System: Debian 8, Apache 2.4.10

Re: Apache 2.4.10 - Kein Rewrite möglich

Postby Kenyan » 11. December 2015 08:37

Okay,

das Problem hat sich in Luft aufgelöst. Im Endeffekt war noch eine falsche Ziffer in der IP-Adresse übriggeblieben, die vom alten Apache-Server stammte.
Die Umleitung funktioniert übrigens so ohne Endlosschleife. Dennoch besten Dank für die Ausführung und die erweiterten Einblicke.
Kenyan
 
Posts: 3
Joined: 10. December 2015 16:41
Operating System: Debian 8, Apache 2.4.10


Return to Apache

Who is online

Users browsing this forum: No registered users and 44 guests