ProxyPass e ReverseProxy não funcionam de fora da rede

2

Eu tenho lutado com o ProxyPass por algumas semanas agora.

Meu problema é que o resultado de qualquer link que eu espero vir do Server2 é a página index.php no Server1 quando acessado de fora da minha rede, seja pelo trabalho via VMware Client ou pelo meu celular, mas tudo funciona como esperado de dentro da minha rede.

Também estou planejando acessar minha instalação do ZoneMinder no Server2, mas esperarei até que eu tenha resolvido o problema de acesso externo. Primeiro, parece que ele funciona bem internamente.

O seguinte é a configuração e eu realmente gostaria de receber ajuda para fazer tudo funcionar corretamente.

SteveW - Wellington - Nova Zelândia

Servidores

Server1 Raspberrypi2 executando o Raspbian (Debian Jessie)
    uname -a = Linux RASPBERRYPI 4.1.13-v7 + # 826 PREPARO SMP Sex 13 de novembro 20:19:03 GMT 2015 armv7l GNU / Linux

Server2 Lenovo M91p rodando o desktop Ubuntu 14.04 LTS
    uname -a = Linux subdominio.dominio.nz 3.19.0-47-genérico # 53 ~ 14.04.1-Ubuntu SMP seg 18 jan 16:09:14 UTC 2016 x86_64 x86_64 x86_64 GNU / Linux

Arquivos de hosts

Server1 em 192.168.20.200

/ etc / hosts

127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

127.0.1.1       raspberrypi

192.168.20.200  domain.nz
192.168.20.210  subdomain.domain.nz

Servidor2 em 192.168.20.210

/ etc / hosts

127.0.0.1       localhost
127.0.1.1       domain.nz

::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

192.168.20.200 domain.nz
192.168.20.210 subdomain.domain.nz

Registos da zona DNS (fornecedor externo)

domain.nz           A       my_ip_address
www.domain.nz       CNAME   domain.nz
subdomain.domain.nz CNAME   domain.nz

Encaminhamento de porta do roteador

192.168.20.200 porta 80 ativada
192.168.20.200 porta 443 ativada

Certificados SSL por letsencrypt

Arquivos Apache2 .conf

Server1

/etc/apache2/sites-available/domain.nz da seguinte forma: -

#domain.nz
#Redirect all incoming requests on 192.168.20.200 port 80 to port 443
<VirtualHost *:80>

    ServerAdmin [email protected]
    ServerName domain.nz
    ServerAlias www.domain.nz
    Redirect permanent / https://domain.nz/

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

#Port 443 on 192.68.20.200
<VirtualHost domain.nz:443>

    ServerAdmin [email protected]
    ServerName domain.nz
    #Web pages live below this
    DocumentRoot /var/www/domain.nz/public_html/

#Deny access to /
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

#Allow Access to web pages
<Directory /var/www/domain.nz/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Require all granted
</Directory>
SSLEngine on
    #Letsencrypt certificates
    SSLCertificateFile /etc/letsencrypt/live/domain.nz/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/domain.nz/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/domain.nz/fullchain.pem

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel debug

    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

#subdomain.domain.nz
<VirtualHost subdomain.domain.nz:80>

    ServerAdmin [email protected]
    ServerName subdomain.domain.nz
    Redirect permanent / https://subdomain.domain.nz/

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

<VirtualHost subdomain.domain.nz:443>

    ServerName subdomain.domain.nz
    ProxyHTMLStripComments on
    ProxyRequests off
    SetOutputFilter proxy-html
    ProxyHTMLDoctype HTML

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

<Proxy *>
 Require all granted
</Proxy>

ProxyPass / https://subdomain.domain.nz/
ProxyPassReverse / https://subdomain.domain.nz/
ProxyHTMLURLMap https://subdomain.domain.nz /

<Location />
  Require all granted
</Location>

</VirtualHost>

Server2 em 192.168.20.210

Pilha da lâmpada instalada com o site em /var/www/domain.nz/public_html /

/etc/apache2/sites-available/subdomain.domain.nz da seguinte forma: -

#subdomain.domain.nz
#Redirect all incoming requests on 192.168.20.210 port 80 to port 443
<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName subdomain.domain.nz
    DocumentRoot /var/www/subdomain.domain.nz/public_html/
    Redirect permanent / https://subdomain.domain.nz/

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

#Port 443 on 192.68.20.210
<VirtualHost *:443>

    ServerAdmin [email protected]
    ServerName subdomain.domain.nz
    #Web pages live below this
    DocumentRoot /var/www/subdomain.domain.nz/public_html/
#Deny access to /
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
#Allow Access to web pages
<Directory /var/www/subdomain.domain.nz/public_html>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Require all granted
</Directory>

SSLEngine on
    #Letsencrypt certificates
    SSLCertificateFile /etc/letsencrypt/live/subdomain.domain.nz/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/subdomain.domain.nz/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/subdomain.domain.nz/fullchain.pem

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel debug

    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
    
por Steve W 27.02.2016 / 09:39

0 respostas