Nginx 웹 리버스 프록시 서버 구성

NGINX 버전

nginx / 1.18.0

컴파일 된 매개 변수

–접두사 = / usr / local / nginx \
–user = nobody \
–group = nobody \
–with-http_stub_status_module \
–with-http_ssl_module \
–with-http_v2_module \
–with-http_gzip_static_module \
–with-http_sub_module \
–스트림 \
–with-stream_ssl_module \
–with-openssl = / usr / local / openssl-1.1.1c \
–with-openssl-opt =’enable-tls1_3 enable-weak-ssl-ciphers’ \
–with-http_flv_module \
–with-http_mp4_module \
–with-http_realip_module \
–with-cc-opt = -DTCP_FASTOPEN = 23 \
–with-file-aio \
–add-module = / usr / local / nginx-ct \
–add-module = / usr / local / ngx_brotli / \
–add-module = / usr / local / nginx_upstream_check \
–http-client-body-temp-path = / var / tmp / nginx / client / \
–http-proxy-temp-path = / var / tmp / nginx / proxy \
–mail_pop3_module없이 \
–mail_imap_module없이 \
–mail_smtp_module없이 \
–http_uwsgi_module없이 \
–http_scgi_module없이

nginx.conf의 HTTP 부분


http
{
mime.types 포함;
default_type 애플리케이션 / 옥텟 스트림;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32케이;
client_max_body_size 5m;
파일 보내기;
tcp_nopush on;
keepalive_timeout 15;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64케이;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;
vhost / *. conf 포함;
업스트림 http {
서버 IP:80;
확인 간격 = 3000 상승 = 2 하강 = 4 시간 초과 = 1000;
}
업스트림 https {
서버 IP:443;
확인 간격 = 3000 상승 = 2 하강 = 4 시간 초과 = 1000;
}
}

HTTP 프로토콜 매개 변수


섬기는 사람 {
들리다 80;
server_name 도메인 www.domain;
#문자셋 koi8-r;
#access_log logs / host.access.log 기본;
위치 / {
proxy_pass http://http;
proxy_set_header X-Real-IP $ remote_addr;
proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for;
proxy_redirect 끄기;
}
}

HTTPS 프로토콜 매개 변수


proxy_cache_path /../path/../domain/static levels = 1:2 keys_zone = local_cache:100m 비활성 = 1d use_temp_path = off max_size = 2g;
섬기는 사람 {
server_name 도메인 www.domain;
들리다 443 SSL http2;
ssl_certificate /../path/../nginx/conf/certificate/domain.crt;
ssl_certificate_key /../path/../nginx/conf/certificate/domain.key;
ssl_session_cache 공유:SSL:18미디엄;
ssl_session_timeout 20m;
ssl_session_tickets on;
ssl_ciphers “ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256, SHA256:DHE-RSA-AES128, SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:높은:!aNULL:!eNULL:!수출:!의:!MD5:!PSK:!RC4”;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
#문자셋 koi8-r;
#access_log logs / host.access.log 기본;
위치 / {
proxy_pass https://https;
#proxy_set_header 호스트 $ http_host;
proxy_set_header 호스트 $ host;
proxy_set_header X-Real-IP $ remote_addr;
proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for;
proxy_redirect 끄기;
}
위치 ~ .*.(mp3|gif|jpg|jpeg|bmp|png|ico|txt|js|CSS|woff2|와우|ttf|svg|EOT)$ {
proxy_pass https://https;
proxy_cache local_cache;
proxy_cache_key $ uri $ is_args $ args;
add_header X-Cache $ upstream_cache_status;
proxy_cache_valid 200 30디;
proxy_cache_valid 301 302 30디;
#proxy_cache_valid any 1m;
30 일 만료;
}
access_log /../path/../domain.log;
}

답장을 남겨주세요