Apache-Httpd

Apache httpd、WebDAV 和多種設置

  • March 9, 2015

我有一個目錄 ( /var/www/dental-atelier.ch/),我想以兩種不同的方式訪問它。

作為一個普通的網頁

<VirtualHost 78.47.122.114:80> 

   ServerAdmin webmaster@dental-atelier.ch 
   DocumentRoot /var/www/dental-atelier.ch 

   <Location /> 
      Options +Includes 
   </Location> 

   ServerName dental-atelier.ch 
   ServerAlias dental-atelier.ch www.dental-atelier.ch 
   ErrorLog logs/dental-atelier.ch-error_log 
   CustomLog logs/dental-atelier.ch-access_log combined 

</VirtualHost> 

一次使用 WebDav(但這次使用 SSL)

<VirtualHost _default_:443>

   DocumentRoot "/var/www/html"

   # Use separate log files for the SSL virtual host; note that LogLevel
   # is not inherited from httpd.conf.
   ErrorLog logs/ssl_error_log
   TransferLog logs/ssl_access_log
   LogLevel warn

   <Directory /var/www/html>
       Options +Includes
   </Directory>

   Alias /webdav /var/www/webdav

   <Directory /var/www/webdav/dental-atelier.ch/> 
       AuthType Basic 
       AuthName "Password Required" 
       AuthUserFile /etc/shadow 
       Require user user 
       DAV On 
       Options Indexes FollowSymLinks 
   </Directory> 

</VirtualHost>

這對 httpd 2.2 沒有任何問題。

升級到 2.4 後,httpd 不允許對同一目錄進行兩種設置。第一個單獨工作(與第一個 vhost 一起),第二個單獨與第二個一起工作。如果我同時配置兩者,我會得到

$ cadaver https://78.47.122.114/webdav/dental-atelier.ch
WARNING: Untrusted server certificate presented for `ip1.corti.li':
Certificate was issued to hostname `ip1.corti.li' rather than `78.47.122.114'
This connection could have been intercepted.
Issued to: ip1.corti.li
Issued by: http://www.CAcert.org, CAcert Inc.
Certificate is valid from Thu, 10 Apr 2014 10:43:34 GMT to Sat, 09 Apr 2016 10:43:34 GMT
Do you wish to accept the certificate? (y/n) y
Authentication required for Password Required on server `78.47.122.114':
Username: user
Password: 
Could not access /webdav/dental-atelier.ch/ (not WebDAV-enabled?):
405 Method Not Allowed
Connection to `78.47.122.114' closed.
dav:!> 

關於如何通過 WebDAV(用於編輯)使 HTTP 共享目錄也可用的任何想法?

SSL 虛擬主機日誌顯示有關Includes在非 SSL 虛擬主機(埠 80)中指定的指令的錯誤:

ssl_access_log:

129.132.179.107 - - [19/Feb/2015:15:40:29 +0100] "OPTIONS /webdav/dental-atelier.ch/ HTTP/1.1" 401 381
129.132.179.107 - user [19/Feb/2015:15:40:34 +0100] "OPTIONS /webdav/dental-atelier.ch/ HTTP/1.1" 200 -
129.132.179.107 - user [19/Feb/2015:15:40:34 +0100] "PROPFIND /webdav/dental-atelier.ch/ HTTP/1.1" 405 261

ssl_error_log:

[Thu Feb 19 15:40:34.556872 2015] [include:warn] [pid 29499] [client 129.132.179.107:65259] AH01374: mod_include: Options +Includes (or IncludesNoExec) wasn't set, INCLUDES filter removed: /webdav/dental-atelier.ch/index.html
[Thu Feb 19 15:40:34.557949 2015] [include:warn] [pid 29499] [client 129.132.179.107:65259] AH01374: mod_include: Options +Includes (or IncludesNoExec) wasn't set, INCLUDES filter removed: /webdav/dental-atelier.ch/index.html

編輯

這個問題實際上與在兩個不同的虛擬主機中以不同方式使用相同的目錄有關。如果我將相同的目錄複製到/var/www/webdav/test並使用該目錄配置 SSL 虛擬主機,那麼test一切都會像魅力一樣。

如果我刪除同一目錄的 HTTP 虛擬主機,這同樣適用。

如果我在兩者中都有相同的數據,那麼 Apache httpd 會以某種方式檢測到它。在 2.2 中不是這樣的。

實際上問題是不同的:目錄包含一個index.html文件,而 Apache httpd 會自動傳遞它。

環境

DirectoryIndex disabled 

解決了這個問題。

引用自:https://unix.stackexchange.com/questions/185708