
我的 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>
問候廷格爾
答案1
經過一些閱讀後,我找到了解決方案。
<LocationMatch "^(?!\/(service1|service2)\/?).*">
#Service config for / except for /service1 or service2
</LocationMatch>