keepalive + nginx 메 인 부하 서버 구축
keepalive 프로필 부터:
- ! Configuration File for keepalived
- global_defs {
- notification_email {
- [email protected]
- }
- notification_email_from [email protected]
- smtp_server mail.yaoshi.com
- smtp_connect_timeout 30
- router_id LVS_DEVEL
- }
- vrrp_instance VI_1 {
- state MASTER
- interface eth0
- virtual_router_id 51
- mcast_src_ip 192.168.11.39
- priority 80
- advert_int 1
- authentication {
- auth_type PASS
- auth_pass chtopnet
- }
- virtual_ipaddress {
- 192.168.11.208
- }
- }
keepalive 주:
- !Configuration File for keepalived
- global_defs {
- notification_email {
- [email protected]
- }
- notification_email_from [email protected]
- smtp_server mail.yaoshi.com
- smtp_connect_timeout 30
- router_id LVS_DEVEL
- }
- vrrp_instance VI_1 {
- state MASTER
- interface eth0
- virtual_router_id 51
- mcast_src_ip 192.168.11.27
- priority 100
- advert_int 1
- authentication {
- auth_type PASS
- auth_pass chtopnet
- }
- virtual_ipaddress {
- 192.168.11.208
- }
- }
nginx 설정:
- user nobody nobody;
- worker_processes 1;
-
- #error_log logs/error.log;
- #error_log logs/error.log notice;
- error_log logs/error.log debug;
-
- pid logs/nginx.pid;
-
-
- events {
- use epoll;
- worker_connections 1024;
- }
-
-
- http {
- include mime.types;
- default_type application/octet-stream;
-
- log_format main '$remote_addr - $remote_user [$time_local] "$request" '
- '$status $body_bytes_sent "$http_referer" '
- '"$http_user_agent" "$http_x_forwarded_for"';
-
- access_log logs/access.log main;
-
- sendfile on;
- #tcp_nopush on;
-
- #keepalive_timeout 0;
- keepalive_timeout 65;
-
- gzip on;
- gzip_min_length 1k;
- gzip_buffers 6 16k;
- gzip_http_version 1.1;
- gzip_comp_level 2;
- gzip_types text/plain application/x-javascript text/css application/xml;
- gzip_vary on;
- # location / {
- # root html;
- # index index.html index.htm;
- # }
- error_page 404 /404.html;
-
- upstream www.test.com {
- server 192.168.11.37:80;
- server 192.168.11.38:80;
- }
-
- server
- {
- listen 80;
- server_name www.test.com 192.168.11.208;
- index index.htm index.html;
- #root /web/wwwroot;
-
- location / {
- proxy_pass http://www.test.com;
- proxy_next_upstream http_500 http_502 http_503 error timeout invalid_header;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- include proxy.conf;
- }
- log_format blog_test_com '$remote_addr - $remote_user [$time_local] $request '
- '"$status" $body_bytes_sent "$http_referer" '
- '"$http_user_agent" "$http_x_forwarded_for"';
- access_log logs/blog_test_com;
- }
- }
proxy. conf 설정
- [root@localhost conf]# cat proxy.conf
- 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_body_buffer_size 128k;
- proxy_connect_timeout 90;
- proxy_send_timeout 90;
- proxy_read_timeout 90;
- proxy_buffer_size 4k;
- proxy_buffers 6 32k;
- proxy_busy_buffers_size 64k;
- proxy_temp_file_write_size 64k;
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Nginx 유 틸 리 티 가이드 V1 (연결 7: 캐 시 와 부하)proxy 를 조건 부 로 실행 하 는 것 으로 바 꾸 는 것 입 니 다.pass, 이 조건 은 요청 한 파일 이 로 컬 에 있 는 proxy 입 니 다.temp_path 가 지정 한 디 렉 터 리 가 존재 하지 않...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.