ServerRoot apache主目錄Listen 監(jiān)聽端口LoadModule 加載的相關(guān)模塊ServerAdmin 管理員郵箱ServerName 服務(wù)器名(沒有域名解析時(shí),使用臨時(shí)解析。不開啟)ErrorLog "logs/error_log 錯(cuò)誤日志CustomLog "logs/access_log" common 正確訪問日志DirectoryIndex index.html index.php 默認(rèn)網(wǎng)頁文件名,優(yōu)先級(jí)順序Include etc/extra/httpd-vhosts.conf 子配置文件中內(nèi)容也會(huì)加載生效主頁的目錄以及權(quán)限
DocumentRoot "/usr/local/apache2//htdocs"<Directory "/usr/local/apache2//htdocs"> #Directory關(guān)鍵字定義目錄權(quán)限 Options Indexes FollowSymLinks #options None:沒有任何額外權(quán)限 All:所有權(quán)限 Indexes: 瀏覽權(quán)限(當(dāng)此目錄下沒有默認(rèn)網(wǎng)頁文件時(shí),顯示目錄內(nèi)容) FollowSymLinks:準(zhǔn)許軟連接到其他目錄 AllowOverride None #定義是否允許目錄下.htaccess文件中的權(quán)限生效 None:.htaccess中權(quán)限不生效 All:文件中所有權(quán)限都生效 AuthConfig:文件中,只有網(wǎng)頁認(rèn)證的權(quán)限生效。 Require all granted 訪問控制列表</Directory>注意:(如果修改訪問權(quán)限) 例1: 僅允許ip為192.168.127.127的主機(jī)訪問 <RequireAll> Require all granted Require ip 192.168.127.127 </RequireAll> -------------------------------------- 例子2.僅允許192.168.0.0/24網(wǎng)絡(luò)的主機(jī)訪問 <RequireAll> Require all granted Require ip 192.168.1.0/24 </RequireAll> -------------------------------------- 例子3.禁止192.168.127.127的主機(jī)訪問,其他的都允許訪問, <RequireAll> Require all granted Require not ip 192.168.127.127 </RequireAll> -------------------------------------- 例子4.允許所有訪問, Require all granted #可以不寫在<RequireAll>。。。</RequireAll>中 -------------------------------------- 例子5.拒絕所有訪問, Require all denied #可以不寫在<RequireAll>。。。</RequireAll>中
新聞熱點(diǎn)
疑難解答
圖片精選