我目前正在运行3个Apache VM:
A) ProxyPass (Hosts Nothing)
B) Main Website
C) ZoneMinder Website
如果您访问example.com,您可以访问该网站,并可以浏览,但是......
如果我手动输入http://example.com/zm尝试访问zoneminder
它会将我的远程浏览器中的http://example.com/zm重定向到http://192.168.1.255:443/foo *
我似乎无法让我的重定向正常工作,有人能看到我做错了吗?
CONFIGS:
A)ProxyPass服务器:
<VirtualHost *:80>
ServerName www.example.com
RedirectPermanent / http://example.com
</VirtualHost>
<VirtualHost *:80>
ServerName example.com
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://192.168.1.255:80/
ProxyPassReverse / http://192.168.1.255:80/
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>
B)主要网站
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/html
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/example.log
CustomLog ${APACHE_LOG_DIR}/example-access.log combined
</VirtualHost>
答案 0 :(得分:0)
搞定了!
设置:
服务器A)仅为proxypass提供服务但不承载任何内容的Apache服务器
服务器B)托管主domain.com的Apache服务器
服务器C)托管ZoneMinder @ domain.com/zm
的Apache服务器服务器A配置:
<VirtualHost *:80>
ServerName domain.com
Redirect / https://www.domain.com/
</VirtualHost>
<VirtualHost *:443>
ServerName www.domain.com
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
SSLProxyEngine On
SSLProxyCheckPeerCN on
SSLProxyCheckPeerExpire on
SSLEngine on
SSLCertificateFile /location of .crt
SSLCertificateKeyFile /location of .key
SSLCACertificateFile /location of .crt
ProxyPreserveHost on
ProxyPass /zm https://192.168.1.43:443/zm
ProxyPassReverse /zm https://192.168.1.43:443/zm
ProxyPass / https://192.168.1.42:443/
ProxyPassReverse / https://192.168.1.42:443/
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>
注意:将/ zm放在&#34; /&#34;之前是非常重要的。抓住一切。如果我使用/ zm /.
,我也注意到它失败了服务器B配置:
<VirtualHost *:443>
ServerName www.domain.com
DocumentRoot /var/www/html
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/domain.log
CustomLog ${APACHE_LOG_DIR}/domain.log combined
SSLEngine on
SSLCertificateFile /location of .crt
SSLCertificateKeyFile /location of .key
SSLCACertificateFile /location of .crt
</VirtualHost>
注意:没有必要使用*:80重定向或服务器别名,因为事先只通过ProxyPass过滤将正确格式化的请求发送到此服务器。
服务器C配置:(domain.com/zm)
<VirtualHost *:443>
ServerName www.domain.com
DocumentRoot /var/www/html
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/domain.log
CustomLog ${APACHE_LOG_DIR}/domain.log combined
SSLEngine on
SSLCertificateFile /location of .crt
SSLCertificateKeyFile /location of .key
SSLCACertificateFile /location of .crt
</VirtualHost>
是的,它是一样的。它的工作原理让我很开心!
注意:所有3台服务器都安装了我的SSL证书,但我没有触及default-ssl.conf。