Web-Server

帶有異常的 Apache 2.4 嵌套位置

  • June 18, 2015

我的 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>     

問候刺痛

經過一些閱讀,我找到了解決方案。

<LocationMatch "^(?!\/(service1|service2)\/?).*">
 #Service config for / except for /service1 or service2 
</LocationMatch>

引用自:https://serverfault.com/questions/698770