国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 服務器 > Web服務器 > 正文

nginx配置相關介紹

2024-09-01 13:44:55
字體:
來源:轉載
供稿:網友

復制代碼 代碼如下:


#運行用戶
user nobody nobody;
#啟動進程
worker_processes 2;
#全局錯誤日志及PID文檔
error_log logs/error.log notice;
pid logs/Nginx.pid;
#工作模式及連接數上限
events {
use epoll;
worker_connections 1024;
}
#設定http服務器,利用他的反向代理功能提供負載均衡支持
http {
#設定mime類型
include conf/mime.types;
default_type application/octet-stream;
#設定日志格式
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status $bytes_sent '
'"$http_referer" "$http_user_agent" '
'"$gzip_ratio"';
log_format download '$remote_addr - $remote_user [$time_local] '
'"$request" $status $bytes_sent '
'"$http_referer" "$http_user_agent" '
'"$http_range" "$sent_http_content_range"';
#設定請求緩沖
client_header_buffer_size 1k;
large_client_header_buffers 4 4k;
#開啟gzip模塊
gzip on;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_types text/plain;
output_buffers 1 32k;
postpone_output 1460;
#設定access log
access_log logs/access.log main;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
#設定負載均衡的服務器列表
upstream mysvr {
#weigth參數表示權值,權值越高被分配到的幾率越大
#本機上的Squid開啟3128端口
server 192.168.8.1:3128 weight=5;
server 192.168.8.2:80 weight=1;
server 192.168.8.3:80 weight=6;
}
#設定虛擬主機
server {
listen 80;
server_name 192.168.8.1


charset gb2312;
#設定本虛擬主機的訪問日志
access_log logs/www.survivalescaperooms.com.access.log main;
#假如訪問 /img/*, /js/*, /css/* 資源,則直接取本地文檔,不通過squid
#假如這些文檔較多,不推薦這種方式,因為通過squid的緩存效果更好
location ~ ^/(img|js|css)/ {
root /data3/Html;
expires 24h;
}
#對 "/" 啟用負載均衡
location / {
proxy_pass ;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
#設定查看Nginx狀態的地址
location /NginxStatus {
stub_status on;
access_log on;
auth_basic "NginxStatus";
auth_basic_user_file conf/htpasswd;
}
}
}



備注:conf/htpasswd 文檔的內容用 apache 提供的 htpasswd 工具來產生即可,內容大致如下:
3.) 查看 Nginx 運行狀態 輸入地址 。
輸入驗證帳號密碼,即可看到類似如下內容:
Active connections: 328
server accepts handled requests
9309 8982 28890
Reading: 1 Writing: 3 Waiting: 324

第一行表示現在活躍的連接數,第三行的第三個數字表示Nginx運行到現在的連接數。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 灵寿县| 林州市| 永泰县| 理塘县| 邯郸市| 康平县| 大安市| 南充市| 鹰潭市| 沅陵县| 金华市| 惠水县| 沁源县| 波密县| 任丘市| 玉田县| 石泉县| 余庆县| 三台县| 黔江区| 石泉县| 左权县| 申扎县| 夹江县| 石河子市| 保靖县| 临泽县| 安顺市| 泾阳县| 巴彦淖尔市| 高淳县| 交城县| 盱眙县| 景泰县| 宝鸡市| 贵阳市| 阳曲县| 辉县市| 临颍县| 托里县| 海林市|