我的 apache2.4 配置有问题。我可以通过以下方式访问由 apache 提供的多项服务:
www.example.com/http-service/ -> 代理传递配置 www.example.com/webservice2/ -> 代理传递配置 www.example.com/service3/ -> 目录网页 www.example.com/websock/ -> 代理传递配置
现在我想在 www.example.com/ 上提供另一个页面
但是当我想使用代理传递配置创建位置时,当前服务不再提供,所有请求都重定向到 -> www.example.com
有没有一个解决方案可以让所有的服务都可用?
<VirtualHost *:443>
ServerName
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
SSLCertificateFile /etc/ssl/certs/www-example-com.pem
SSLCertificateKeyFile /etc/ssl/private/www-example-com.key
SSLCertificateChainFile /etc/ssl/certs/www-example-com.chain
<Directory "/converee/">
Options FollowSymLinks
AllowOverride None
</Directory>
<Location /http-service>
Require all granted
AllowOverride None
ProxyPass https://localhost:5200/http-service/
ProxyPassReverse https://localhost:5200/http-service/
</Location>
ProxyPass /webservice2 https://127.0.0.1:6000/
ProxyPass /websock wss://127.0.0.1:6000/websock retry=3
ProxyPassReverse /webservice2 https://127.0.0.1:6000/
ProxyPassReverse /websock wss://127.0.0.1:6000/websock retry=3
RedirectMatch permanent /webservice2$ /webservice2/
<Location />
Allow from all
AllowOverride None
ProxyPass http://localhost:3030/
ProxyPassReverse http://localhost:3030/
</Location>
<Directory "/var/www/service3">
Options Indexes FollowSymLinks
MultiViews
AllowOverride All
Order allow,deny
</Directory>
问候 Tingle
答案1
读了一些资料后我找到了解决方案。
<LocationMatch "^(?!\/(service1|service2)\/?).*">
#Service config for / except for /service1 or service2
</LocationMatch>