2019年12月28日星期六

Apache2反向代理配置示例

 配置文件:Proxy.conf


<VirtualHost *:555>

     ServerName cn.cn

     SSLEngine on

     SSLProxyEngine on

     #反向代理设置

     AllowEncodedSlashes NoDecode

        ProxyPass /  http://localhost:5212/

        ProxyPassReverse /  http://localhost:5212/


SSLCertificateFile /etc/apache2/ssl/2_cn.cn.crt

   SSLCertificateKeyFile /etc/apache2/ssl/3_cn.cn.key


     <Directory />

                 Options Indexes FollowSymLinks MultiViews

                 AllowOverride all

                 Order deny,allow

                 Allow from all

     </Directory>

 </VirtualHost>

 

 <VirtualHost *:444>

     ServerName s.cn.cn

     SSLEngine on

     SSLProxyEngine on

     #反向代理设置

     AllowEncodedSlashes NoDecode

        ProxyPass /  http://localhost:5212/

        ProxyPassReverse /  http://localhost:5212/


SSLCertificateFile /etc/apache2/ssl/2_s.cn.cn.crt

   SSLCertificateKeyFile /etc/apache2/ssl/3_s.cn.cn.key


     <Directory />

                 Options Indexes FollowSymLinks MultiViews

                 AllowOverride all

                 Order deny,allow

                 Allow from all

     </Directory>

 </VirtualHost>

 

  <VirtualHost *:666>

     ServerName d.cn.cn

     SSLEngine off

     SSLProxyEngine off

     #反向代理设置

     AllowEncodedSlashes NoDecode

        ProxyPass /  http://localhost:8090/

        ProxyPassReverse /  http://localhost:8090/


SSLCertificateFile /etc/apache2/ssl/2_d.cn.cn.crt

   SSLCertificateKeyFile /etc/apache2/ssl/3_d.cn.cn.key

     <Directory />

                 Options Indexes FollowSymLinks MultiViews

                 AllowOverride all

                 Order deny,allow

                 Allow from all

     </Directory>

 </VirtualHost>



配置文件:ports.conf

# If you just change the port or add more ports here, you will likely also

# have to change the VirtualHost statement in

# /etc/apache2/sites-enabled/000-default.conf


Listen 80

Listen 666


<IfModule ssl_module>

Listen 443

Listen 444

Listen 555

</IfModule>


<IfModule mod_gnutls.c>

Listen 443

</IfModule>


# vim: syntax=apache ts=4 sw=4 sts=4 sr noet