#啟動子程序程式預設使用者
#user nobody;
#乙個主程序和多個工作程序。工作程序是單程序的,且不需要特殊授權即可執行;這裡定義的是工作程序數量
worker_processes 1;
#全域性錯誤日誌的位置及日誌格式
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events
#日誌格式
#$remote_addr與$http_x_forwarded_for用以記錄客戶端的ip位址;
#$remote_user:用來記錄客戶端使用者名稱;
#$time_local: 用來記錄訪問時間與時區;
#$request: 用來記錄請求的url與http協議;
#$status: 用來記錄請求狀態;成功是200,
#$body_bytes_sent :記錄傳送給客戶端檔案主體內容大小;
#$http_referer:用來記錄從那個頁面鏈結訪問過來的;
#$http_user_agent:記錄客戶瀏覽器的相關資訊;
#長連線超時時間
#keepalive_timeout 0;
keepalive_timeout 65;
#開啟壓縮
#gzip on;
#配置虛擬主機
server
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
##根據錯誤碼 返回對應的頁面
error_page 500 502 503 504 /50x.html;
#定義頁面路徑
location = /50x.html
#定義反向**伺服器 資料伺服器是lamp模型
# proxy the php scripts to apache listening on 127.0.0.1:80
##location ~ \.php$
#定義php為本機服務的模型
# pass the php scripts to fastcgi server listening on 127.0.0.1:9000
##location ~ \.php$
# deny access to .htaccess files, if apache's document root
# concurs with nginx's one
##拒絕apache dr目錄及子目錄下的.htaccess檔案訪問
#location ~ /\.ht
}# another virtual host using mix of ip-, name-, and port-based configuration
##server
#}#https的配置方案
03 nginx虛擬主機配置
nginx的配置段比apache簡單。好的伺服器都有4塊cpu,每塊cpu是8核,最多有32個核工作。比如我的是4核pc,所以把worker processes設定為4,再多意義也不大。後面還要講nginx的優化,只改worker connections意義不大,還需要和系統的一些引數配合才行。4塊...
web容器 03 Nginx配置負載均衡
正向 a同學在大眾創業 萬眾創新的大時代背景下開啟他的創業之路,目前他遇到的最大的乙個問題就是啟動資金,於是他決定去找馬雲爸爸借錢,可想而知,最後碰一鼻子灰回來了,情急之下,他想到乙個辦法,找關係開後門,經過一番訊息打探,原來a同學的大學老師王老師是馬雲的同學,於是a同學找到王老師,託王老師幫忙去馬...
nginx配置檔案
執行使用者 user nobody nobody 啟動程序 worker processes 2 全域性錯誤日誌及pid文件 error log logs error.log notice pid logs nginx.pid 工作模式及連線數上限 events 設定http伺服器,利用他的反向 功...