Apache2 作为反向代理不起作用?

Apache2 作为反向代理不起作用?

你好,我正在尝试将 apache2 设置为 Ubuntu 上的反向代理。对于支持我有 tomcat 7。 对于配置文件 /etc/apache2/sites-enabled/example.co.conf

<VirtualHost *:80>
        ServerName example.co
        ServerAlias *example.co
        ServerSignature Off

        RewriteEngine On
        RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

        ErrorLog /var/log/apache2/redirect.error.log
        LogLevel debug
</VirtualHost>


<VirtualHost *:443>
        ServerName example.co
        ServerAlias *example.co
        ProxyPreserveHost On
        ProxyRequests off
        AllowEncodedSlashes NoDecode

    <Proxy *>
          Order deny,allow
          Allow from all

    </Proxy>

        SSLEngine on
        SSLCertificateFile /etc/letsencrypt/live/example.co/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/example.co/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf

        ProxyPass / http://localhost:8080/ nocanon
        ProxyPassReverse / http://localhost:8080/

        RequestHeader set X-Forwarded-Proto "https"
        RequestHeader set X-Forwarded-Port "443"

        LogLevel debug
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

我尝试使用以下方法进行检查:

$elinks https://localhost 

它是有效的,但当我从外面尝试时却不起作用。

任何帮助!

答案1

我注意到我没有在亚马逊AWS上打开443端口。我打开端口后就可以了。这个配置对我有用。

相关内容