歡迎你

各類文章如有侵犯智慧財產權請來信告知--------607@dlps.tp.edu.tw

预览模式: 普通 | 列表

apache2/httpd.conf初步設定

 

/usr/local/etc/apache2/httpd.conf
Timeout 設定連線逾時
Timeout 300
 
KeepAlive 是否使用保持連線
KeepAlive On
 
MaxKeepAliveRequests 最多有幾個保持連線
MaxKeepAliveRequests 200
 
KeepAliveTimeout 保持連線的逾時時間
KeepAliveTimeout 15
 
User Group 設定執行時的使用者及群組
User www
Group www
 
ServerAdmin 設定郵件
ServerAdmin you@example.com
 
ServerName 設定主機名稱
ServerName XXX.XXX.XXX:80
 
DocumentRoot 設定網頁根目錄
DocumentRoot "/usr/local/www/apach22/data"
 
<Directory> </Directory> 設定目錄權限
<Directory />
    AllowOverride None
    order deny,allow
    Deny from all
</Directory>
AllowOverride 設定 .htaccess 中可以使用的項目
Order 設定 Allow 及 Deny 的順序,目錄中設定允許 (Allow) 及拒絕 (Deny) 的規則先後順序
我們先設定了 order 為 Deny, Allow,再設定允許所有連線
 
 
UserDir 設定使用者個人網頁
<IfModule mod_userdir.c>
UserDir public_html
 
UserDir disabled root toor daemon ..... pop www nobody mailnull smmsp
 
#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
<Directory /home/*/public_html>
    AllowOverride FileInfo AuthConfig Limit Indexes
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    <Limit GET POST OPTIONS PROPFIND>
        order allow,deny
        Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS PROPFIND>
        order deny,allow
        Deny from all
    </LimitExcept>
</Directory>
</IfModule>
 
 
DirectoryIndex 設定預設網頁檔名
DirectoryIndex index.php index.htm index.html index.html.var
 
 
HostnameLookups 設定將客戶端 IP 轉為 hostname
將這個功能設為 On 會造成連線的效率變慢很多
HostnameLookups Off
 
 
ErrorLog 指定錯誤記錄檔位置
ErrorLog /var/log/httpd-error.log
設定 Apache 連線記錄檔的位置
CustomLog /var/log/httpd-access.log combined
 
Alias 設定別名
Alias /mp3/ /home/alex/mp3/
 
ScriptAlias 設定 CGI 目錄
ScriptAlias /cgi-bin/ "/usr/local/www/cgi-bin/"
 
分类:FreeBSd | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 9727