2、nginx配置文件
2、nginx配置文件
user [user] [group];//運行nginx的用戶(組)(只能在全局設(shè)置)
worker process number|auto;//允許生成的worker process數(shù)(只能在全局設(shè)置,通常設(shè)置成和cpu的數(shù)量相等?)
pid file;//nginx進程的Pid存放路徑(只能在全局設(shè)置)
error_log file | stderr[debug|info|notice|warn|error|crit|alert|emerg];//日志的存放路徑和類型(可以在任意位置設(shè)置)
events
{
accept_mutex on|off;//設(shè)置網(wǎng)絡(luò)連接的序列化,驚群(默認on)(只能在event塊設(shè)置)
multi_accept on|off;//設(shè)置worker process是否允許同時接受多個網(wǎng)絡(luò)連接(默認off)(只能在event塊設(shè)置)
use method[select|poll|kqueue|epoll|rtsig|/dev/poll|evenport];//時間驅(qū)動模型的選擇(默認select);(只能在event塊設(shè)置)
worker_connections number;//配置每個worker process同時開啟的最大連接數(shù)(默認512);(只能在event塊設(shè)置)
}
http
{
include mime.types;//文件引入(可以在任意位置設(shè)置?設(shè)定mime類型,類型由mime.type文件定義?)
default_type application/octet-stream;//MIME_Type定義;(可以在http server location位置設(shè)置)
access_log path [format [buffer=size]];//format:配置服務(wù)日志的格式字符串 size:配置臨時存放日志的內(nèi)存緩存區(qū)大下;(可以在http server location位置設(shè)置)
access_log off;//取消記錄日志的服務(wù)?
log_format name string……;//日志格式自定義;(在http塊設(shè)置)
sendfile on|off;//是否使用sendfile傳輸文件(默認off);(可以在http server location位置設(shè)置))
sendfile_max_chunk size;//nginx的每一個worker process每次調(diào)用sendfile()傳輸?shù)臄?shù)據(jù)量最大值(默認為0,無上限);(可以在http server location位置設(shè)置))
keepalive_timeout timeout[header_timeout];//服務(wù)器端對連接的保持時間(默認75s);(可以在http server location位置設(shè)置))
keepalive_requests number;//單連接請求數(shù)上限(默認100s)(只能在server location塊設(shè)置)
send_timeout timeout;//設(shè)置nginx服務(wù)器響應(yīng)客戶端的超時時間
?client_body_in_single_buffer ? ?on;
?client_body_buffer_size ? ? ? ? 16m;
?client_header_buffer_size ? ? ? 1k;//nginx服務(wù)器允許的科幻段請求頭部的緩沖區(qū)大小(默認1K)#getconf ?PAGESIZE(查看系統(tǒng)分頁大小)
?client_max_body_size ? ? ? ? ? ?16m;
?server_names_hash_bucket_size ? 128;
?large_client_header_buffers ? ? 4 32k;
server
{
listen address[:port]|port|unix:path;//本虛擬主機的監(jiān)聽配置
? ? server_name name1 name2;//本虛擬主機的名稱或IP配置
? ? (name中可以使用通配符*(只能用在由三段字符組成的名稱的段首或段尾或兩段字符串的段尾),正則表達式(用~作為增則表達式的開始標記))
location [=|~|~*|^~] uri {……}
uri變量是待匹配的請求字符串,可以是不含正則表達的字符串(/data/test.php)(標準uri),可以使含正則表達的字符串(\.php$)(正則uri)
"=":用于標準的uri之前,請求字符串與url嚴格匹配
"^=":用于標準uri之前,請求字符串匹配成功,就不再匹配其他location
"~":用于正則uri之前,請求字符串區(qū)分大小寫
"~*":用于正則uri之前,請求字符串不區(qū)分大小寫
{
root path;//配置請求的根目錄
index file;//設(shè)置網(wǎng)頁的默認首頁
}
? ? location
? ? {
? ? }
}
server
{
}
}
include file;//配置文件的引入,可以放在配置文件的任意地方
轉(zhuǎn)載于:https://blog.51cto.com/10630401/1929950
總結(jié)
以上是生活随笔為你收集整理的2、nginx配置文件的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python简单爬虫(一)
- 下一篇: defunct 进程占用端口_UAV心跳