nginx 설정 관련 안내

 
  
#   
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  
www.jb51.net  

charset gb2312;  
#   
access_log logs/www.jb51.net.access.log main;  
# /img/*, /js/*, /css/* , , squid  
# , , squid   
location ~ ^/(img|js|css)/ {  
root /data3/Html;  
expires 24h;  
}  
# "/"   
location / {  
proxy_pass http://mysvr;  
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 실행 상태 보기 주소 입력http://192.168.8.1/NginxStatus/ 。
인증 계 정 비밀 번 호 를 입력 하면 다음 과 같은 내용 을 볼 수 있 습 니 다.
Active connections: 328
server accepts handled requests
9309 8982 28890
Reading: 1 Writing: 3 Waiting: 324
첫 줄 은 현재 활성 화 된 연결 수 를, 세 번 째 줄 의 세 번 째 숫자 는 Nginx 가 현재 실행 중인 연결 수 를 나 타 냅 니 다.

좋은 웹페이지 즐겨찾기