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 가 현재 실행 중인 연결 수 를 나 타 냅 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.