ubuntuusers.de

o2 Home Box Port Forwarding + Apache2 nicht möglich?

Status: Gelöst | Ubuntu-Version: Ubuntu 16.04 (Xenial Xerus)
Antworten |

assmannphi

Anmeldungsdatum:
3. Januar 2017

Beiträge: Zähle...

Hallo. Immer wenn ich versuche, von innerhalb über mein dynamic dns auf meinen Webserver zu kommen, gibt es einen Redirect auf die Ip des Servers in meinem Netz. D.h webserver.ddnss.de wird immer nach 192.168.1.4:80 weitergeleitet. Von außerhalb kommt 'Webseite nicht verfügbar' bei der Router IP-eingabe. Wie bekomme ich das zum laufen? Übrigens, wenn ich auf eine Unterurl meines Servers gehe , z. B. /ordner1, dann funktioniert es einwandfrei!. Vielen Dank im Voraus, aphi.

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14352

assmannphi schrieb:

Immer wenn ich versuche, von innerhalb über mein dynamic dns auf meinen Webserver zu kommen, gibt es einen Redirect auf die Ip des Servers in meinem Netz. D.h webserver.ddnss.de wird immer nach 192.168.1.4:80 weitergeleitet.

Ja, weil dein Router (evtl. richtigerweise) Hairpin-NAT macht.

assmannphi schrieb:

Von außerhalb kommt 'Webseite nicht verfügbar' bei der Router IP-eingabe. Wie bekomme ich das zum laufen?

Was genau meinst Du mit "außerhalb" bzw. was genau meinst Du mit "Router IP-" (... die interne oder die externe)?

assmannphi

(Themenstarter)

Anmeldungsdatum:
3. Januar 2017

Beiträge: 29

Die externe meine ich. Ich hab mal einen Minecraft-Server mit DynDNS gehostet, da ging das problemlos, der Server dafür stand im Keller. Muss ich evtll beim Apache noch eine "Antwort" einstellen?

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14352

assmannphi schrieb:

Die externe meine ich. Ich hab mal einen Minecraft-Server mit DynDNS gehostet, da ging das problemlos, ...

Du könntest z. B. auf deinem Server, mit tcpdump (oder gleichwertig) und dem geeigneten Filter, schauen ob Datenpakete aus dem Internet auf dem Port 80 ankommen. Wenn ja, wird das Problem evtl. an der Konfiguration des apache2 liegen.

assmannphi

(Themenstarter)

Anmeldungsdatum:
3. Januar 2017

Beiträge: 29

Also, ich hab mit sudo tcpdump -n port 80 folgendes reingekriegt beim externen Aufruf über Tor:

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on enp3s0, link-type EN10MB (Ethernet), capture size 262144 bytes
13:18:12.219996 IP 192.36.27.4.54868 > 192.168.1.4.80: Flags [S], seq 4074783684, win 29200, options [mss 1452,sackOK,TS val 240909683 ecr 0,nop,wscale 7], length 0
13:18:12.220044 IP 192.168.1.4.80 > 192.36.27.4.54868: Flags [S.], seq 1032789495, ack 4074783685, win 28960, options [mss 1460,sackOK,TS val 39259321 ecr 240909683,nop,wscale 7], length 0
13:18:12.247516 IP 192.36.27.4.54868 > 192.168.1.4.80: Flags [.], ack 1, win 229, options [nop,nop,TS val 240909690 ecr 39259321], length 0
13:18:12.249726 IP 192.36.27.4.54868 > 192.168.1.4.80: Flags [P.], seq 1:288, ack 1, win 229, options [nop,nop,TS val 240909691 ecr 39259321], length 287: HTTP: GET / HTTP/1.1
13:18:12.249870 IP 192.168.1.4.80 > 192.36.27.4.54868: Flags [.], ack 288, win 235, options [nop,nop,TS val 39259328 ecr 240909691], length 0
13:18:12.509106 IP 192.168.1.4.80 > 192.36.27.4.54868: Flags [P.], seq 1:696, ack 288, win 235, options [nop,nop,TS val 39259393 ecr 240909691], length 695: HTTP: HTTP/1.1 301 Moved Permanently
13:18:12.537076 IP 192.36.27.4.54868 > 192.168.1.4.80: Flags [.], ack 696, win 239, options [nop,nop,TS val 240909763 ecr 39259393], length 0
13:18:17.514339 IP 192.168.1.4.80 > 192.36.27.4.54868: Flags [F.], seq 696, ack 288, win 235, options [nop,nop,TS val 39260644 ecr 240909763], l 

misterunknown Team-Icon

Ehemalige
Avatar von misterunknown

Anmeldungsdatum:
28. Oktober 2009

Beiträge: 4403

Wohnort: Sachsen

Was sagt denn

curl -i "http://$DEINE_DOMAIN"

assmannphi

(Themenstarter)

Anmeldungsdatum:
3. Januar 2017

Beiträge: 29

Das hier:

HTTP/1.1 301 Moved Permanently
Date: Tue, 03 Jan 2017 12:30:11 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
Vary: Cookie
X-Powered-By: PHP/5.6.28
Set-Cookie: session-1=dce601ed3c92a4ea249ef3bd5dc3c85233c04499c50f2e00003107e8d9f083a9; path=/; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: http://192.168.1.4
Cache-Control: nocache, private
Set-Cookie: session-1=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/
X-Frame-Options: SAMEORIGIN
Content-Length: 0
Content-Type: text/html; charset=UTF-8

misterunknown Team-Icon

Ehemalige
Avatar von misterunknown

Anmeldungsdatum:
28. Oktober 2009

Beiträge: 4403

Wohnort: Sachsen

assmannphi schrieb:

HTTP/1.1 301 Moved Permanently
...
Location: http://192.168.1.4

Da hast du das Problem: Wenn du mit deinem DynDNS-Name am Apache2 ankommst, leitet er dich hart um, und zwar auf eine private IP, die im Internet nicht erreichbar ist. Du musst also deinen Apache umkonfigurieren. Wie sieht dein VHost aus?

assmannphi

(Themenstarter)

Anmeldungsdatum:
3. Januar 2017

Beiträge: 29

<VirtualHost *:80>
    ServerName shopware.example.com
    ServerAlias www.shopware.example.com
    DocumentRoot "/home/aphi/shopware-5.2.12-0/apps/shopware/htdocs"
    ServerAlias da****ew.ddnss.de
    ServerAlias www.da****ew.ddnss.de
    Include "/home/aphi/shopware-5.2.12-0/apps/shopware/conf/httpd-app.conf"
</VirtualHost>

<VirtualHost *:443>
    ServerName shopware.example.com
    ServerAlias www.shopware.example.com
    DocumentRoot "/home/aphi/shopware-5.2.12-0/apps/shopware/htdocs"
    SSLEngine on
    SSLCertificateFile "/home/aphi/shopware-5.2.12-0/apps/shopware/conf/certs/server.crt"
    SSLCertificateKeyFile "/home/aphi/shopware-5.2.12-0/apps/shopware/conf/certs/server.key"
    
    Include "/home/aphi/shopware-5.2.12-0/apps/shopware/conf/httpd-app.conf"
</VirtualHost>

Bearbeitet von misterunknown:

DDNS-Name anonymisiert.

misterunknown Team-Icon

Ehemalige
Avatar von misterunknown

Anmeldungsdatum:
28. Oktober 2009

Beiträge: 4403

Wohnort: Sachsen

Das sieht erstmal in Ordnung aus. Dann ist die Frage, wo die Umleitung herkommt. Sind das alle VHosts auf dem System? Welcher ist der Default-VHost? Gibt es eine .htaccess Datei im DocumentRoot, welche irgendwelche Umleitungen oder Rewrites macht? Was steht in der Datei /home/aphi/shopware-5.2.12-0/apps/shopware/conf/httpd-app.conf?

assmannphi

(Themenstarter)

Anmeldungsdatum:
3. Januar 2017

Beiträge: 29

Hier die Shopware-htaccess Datei:

<Directory "/home/aphi/shopware-5.2.12-0/apps/shopware/htdocs">
<IfModule mod_rewrite.c>
RewriteEngine on

#RewriteBase /shopware/

# Https config for the backend
#RewriteCond %{HTTPS} !=on
#RewriteRule backend/(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteRule shopware.dll shopware.php
RewriteRule files/documents/.* engine [NC,L]
RewriteRule backend/media/(.*) media/$1 [NC,L]

RewriteCond %{REQUEST_URI} !(\/(engine|files|templates|themes|web)\/)
RewriteCond %{REQUEST_URI} !(\/media\/(archive|banner|image|music|pdf|unknown|video)\/)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ shopware.php [PT,L,QSA]

# Fix missing authorization-header on fast_cgi installations
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
</IfModule>

<IfModule mod_alias.c>
    # Block access to VCS directories
    RedirectMatch 404 /\\.(svn|git|hg|bzr|cvs)(/|$)

    # Restrict access to root folder files
    RedirectMatch 404 /(composer\.(json|lock)|README\.md|UPGRADE\.md)$
</IfModule>

# Staging environment
#SetEnvIf Host "staging.test.shopware.in" SHOPWARE_ENV=staging

# Development environment
#SetEnvIf Host "dev.shopware.in" SHOPWARE_ENV=dev
#SetEnv SHOPWARE_ENV dev

DirectoryIndex index.html
DirectoryIndex index.php
DirectoryIndex shopware.php

# Disables download of configuration
<Files ~ "\.(tpl|yml|ini)$">
    # Deny all requests from Apache 2.4+.
    <IfModule mod_authz_core.c>
          Require all denied
    </IfModule>

    # Deny all requests from Apache 2.0-2.2.
    <IfModule !mod_authz_core.c>
        Deny from all
    </IfModule>
</Files>

# Enable gzip compression
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/xml text/plain text/css text/javascript application/javascript application/json
</IfModule>

<Files ~ "\.(jpe?g|png|gif|css|js|woff|eot)$">
    <IfModule mod_expires.c>
        ExpiresActive on
        ExpiresDefault "access plus 1 month"
    </IfModule>

    <IfModule mod_headers.c>
        Header append Cache-Control "public"
        Header unset ETag
    </IfModule>

    FileETag None
</Files>

# Match generated files like:
# 1429684458_t22_s1.css
# 1429684458_t22_s1.js
<FilesMatch "([0-9]{10})_(.+)\.(js|css)$">
    <ifModule mod_headers.c>
        Header set Cache-Control "max-age=31536000, public"
    </ifModule>

    <IfModule mod_expires.c>
        ExpiresActive on
        ExpiresDefault "access plus 1 year"
    </IfModule>
</FilesMatch>

# Disables auto directory index
<IfModule mod_autoindex.c>
	Options -Indexes
</IfModule>

<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

<IfModule mod_php5.c>
#  php_value memory_limit 256M
#  php_value max_execution_time 120
#  php_value upload_max_filesize 20M
   php_flag phar.readonly off
   php_flag magic_quotes_gpc off
   php_flag session.auto_start off
   php_flag suhosin.session.cryptua off
   php_flag zend.ze1_compatibility_mode off
   php_value always_populate_raw_post_data -1
</IfModule>

#   AddType x-mapp-php5 .php
#   AddHandler x-mapp-php5 .php

<IfModule mod_headers.c>
    Header append X-Frame-Options SAMEORIGIN
</IfModule>

</Directory>
<Directory "/home/aphi/shopware-5.2.12-0/apps/shopware/htdocs/bin">
# Deny all requests from Apache 2.4+.
<IfModule mod_authz_core.c>
      Require all denied
</IfModule>

# Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c>
    Deny from all
</IfModule>

</Directory>
<Directory "/home/aphi/shopware-5.2.12-0/apps/shopware/htdocs/engine/Library">
<Files ~ "\.php$">
    # Deny all requests from Apache 2.4+.
    <IfModule mod_authz_core.c>
          Require all denied
    </IfModule>

    # Deny all requests from Apache 2.0-2.2.
    <IfModule !mod_authz_core.c>
        Deny from all
    </IfModule>
</Files>

</Directory>
<Directory "/home/aphi/shopware-5.2.12-0/apps/shopware/htdocs/files/documents">
# Deny all requests from Apache 2.4+.
<IfModule mod_authz_core.c>
      Require all denied
</IfModule>

# Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c>
    Deny from all
</IfModule>

</Directory>
<Directory "/home/aphi/shopware-5.2.12-0/apps/shopware/htdocs/media">
<IfModule mod_rewrite.c>
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ ../shopware.php?controller=Media&action=fallback [PT,L,QSA]
</IfModule>

</Directory>
<Directory "/home/aphi/shopware-5.2.12-0/apps/shopware/htdocs/media/temp">
# Deny all requests from Apache 2.4+.
<IfModule mod_authz_core.c>
      Require all denied
</IfModule>

# Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c>
    Deny from all
</IfModule>

</Directory>
<Directory "/home/aphi/shopware-5.2.12-0/apps/shopware/htdocs/recovery/common/vendor/slim/slim">
RewriteEngine On

# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
# RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
</Directory>
<Directory "/home/aphi/shopware-5.2.12-0/apps/shopware/htdocs/recovery/install">
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=MOD_REWRITE:1]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

DirectoryIndex index.php

</Directory>
<Directory "/home/aphi/shopware-5.2.12-0/apps/shopware/htdocs/recovery/install/data">
# Deny all requests from Apache 2.4+.
<IfModule mod_authz_core.c>
      Require all denied
</IfModule>

# Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c>
    Order Deny,Allow
    Deny from all
</IfModule>

</Directory>
<Directory "/home/aphi/shopware-5.2.12-0/apps/shopware/htdocs/recovery/update">
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=MOD_REWRITE:1]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

DirectoryIndex index.php

</Directory>
<Directory "/home/aphi/shopware-5.2.12-0/apps/shopware/htdocs/recovery/update/data">
# Deny all requests from Apache 2.4+.
<IfModule mod_authz_core.c>
      Require all denied
</IfModule>

# Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c>
    Order Deny,Allow
    Deny from all
</IfModule>

</Directory>
<Directory "/home/aphi/shopware-5.2.12-0/apps/shopware/htdocs/themes/Frontend/Responsive/frontend/_public/src/fonts">
<FilesMatch "\.(ttf|eot|svg|woff)$">
    <IfModule mod_expires.c>
        ExpiresActive on
        ExpiresDefault "access plus 1 year"
    </IfModule>

    <IfModule mod_headers.c>
        Header set Cache-Control "max-age=31536000, public"
        Header unset ETag
    </IfModule>

    FileETag None
</FilesMatch>

</Directory>
<Directory "/home/aphi/shopware-5.2.12-0/apps/shopware/htdocs/themes/Frontend/Responsive/frontend/_public/vendors/fonts/open-sans-fontface">
<FilesMatch "\.(ttf|eot|svg|woff)$">
    <IfModule mod_expires.c>
        ExpiresActive on
        ExpiresDefault "access plus 1 year"
    </IfModule>

    <IfModule mod_headers.c>
        Header set Cache-Control "max-age=31536000, public"
        Header unset ETag
    </IfModule>

    FileETag None
</FilesMatch>
</Directory>
<Directory "/home/aphi/shopware-5.2.12-0/apps/shopware/htdocs/var/log">
# Deny all requests from Apache 2.4+.
<IfModule mod_authz_core.c>
      Require all denied
</IfModule>

# Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c>
    Deny from all
</IfModule>

</Directory>
<Directory "/home/aphi/shopware-5.2.12-0/apps/shopware/htdocs/vendor">
<Files ~ "\.php$">
    # Deny all requests from Apache 2.4+.
    <IfModule mod_authz_core.c>
          Require all denied
    </IfModule>

    # Deny all requests from Apache 2.0-2.2.
    <IfModule !mod_authz_core.c>
        Deny from all
    </IfModule>
</Files>

</Directory>

assmannphi

(Themenstarter)

Anmeldungsdatum:
3. Januar 2017

Beiträge: 29

Und hier die httpdapp.conf

<IfDefine USE_PHP_FPM>
    <Proxy "unix:/home/aphi/shopware-5.2.12-0/php/var/run/shopware.sock|fcgi://shopware-fpm" timeout=300>
    </Proxy>
</IfDefine>

<Directory "/home/aphi/shopware-5.2.12-0/apps/shopware/htdocs">
    Options +MultiViews
    AllowOverride None
    <IfVersion < 2.3 >
        Order allow,deny
        Allow from all
    </IfVersion>
    <IfVersion >= 2.3>
        Require all granted
    </IfVersion>
    
    
    <IfModule php5_module>
            php_value memory_limit 256M
    </IfModule>

    <IfDefine USE_PHP_FPM>
       <FilesMatch \.php$>
         SetHandler "proxy:fcgi://shopware-fpm"
       </FilesMatch>
    </IfDefine>

    Include "/home/aphi/shopware-5.2.12-0/apps/shopware/conf/banner.conf"
</Directory>

Include "/home/aphi/shopware-5.2.12-0/apps/shopware/conf/htaccess.conf"
                    

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14352

assmannphi schrieb:

Das hier:

Location: http://192.168.1.4

Wo hast Du:

curl -i "http://$DEINE_DOMAIN"

ausgeführt? Evtl. in deinem (W)LAN?

assmannphi

(Themenstarter)

Anmeldungsdatum:
3. Januar 2017

Beiträge: 29

Ja im Wlan

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14352

assmannphi schrieb:

Ja im Wlan

dann ist ja klar, von wo 192.168.1.4 kommt.

Mach mal aus dem Internet.

Antworten |