我在 Fedora 服務器 35 上運行 httpd 并想用它來提供本地網路上的檔案。它適用于直接存盤在 /var/www/html 目錄下的檔案(例如 /var/www/html/videos/video.mp4 可以在任何本地設備上使用 http://IP/videos/video.mp4 訪問) .
我想提供存盤在檔案系統中其他位置的檔案。我的計劃是創建指向這些位置的符號鏈接。當我這樣做時,我在嘗試訪問檔案時遇到了禁止的錯誤(例如,與符號鏈接 /var/www/html/videos-link -> /files/videos 鏈接的視頻檔案 /files/videos/video.mp4 / 這樣我就可以(理論上)使用 http://IP/videos-link/video.mp4 訪問它
我可以很好地導航到 http://IP/videos-link(目錄頁面的索引,但沒有列出任何檔案),但嘗試訪問該檔案(http://IP/videos-link/video.mp4)給出我403禁止。
我的配置(/etc/httpd/conf/httpd.conf)看起來像這樣(有點亂,因為我一直在嘗試自己解決這個問題):
<Directory />
Options FollowSymLinks Indexes
AllowOverride All
Require all granted
</Directory>
...
<Directory "/var/www">
Options FollowSymLinks Indexes
AllowOverride All
Require all granted
</Directory>
...
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
...
<Directory "/files/videos">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
為了使它作業,我確保符號鏈接和所有目錄都具有相同的所有者,并且它們都是 777,因此所有權/讀取權限不應該成為問題。非常感謝一些幫助,謝謝。
uj5u.com熱心網友回復:
我的問題是 SELinux。為了讓它立即作業,我可以將 SELinux 設定為許可模式
# setenforce 0
這會在啟動時重繪 并且可能不安全,因此永久修復(僅讓 httpd 通過)將是:
# semanage permissive -a httpd_t
有關 Fedora 中 SELinux 的更多詳細資訊,請訪問:https ://docs.fedoraproject.org/en-US/quick-docs/getting-started-with-selinux/
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/477158.html
標籤:阿帕奇 服务器 软呢帽 httpd.conf
上一篇:如何使用正則運算式多次匹配組
