[nginx] confIT/nginx2023. 3. 29. 10:10
Table of Contents
PATH /etc/nginx/nginx.conf
# listen
http {
server {
listen 80; # ipv4
listen [::]:80; # ipv6
listen 443;
listen [::]:443;
}
}
# return 301 (80 -> 443)
# https://nginx.org/en/docs/stream/ngx_stream_return_module.html
http {
server {
listen 80; # ipv4
listen [::]:80; # ipv6
# http -> https redirection
return 301 $server_name$request_uri;
}
}
# ssl
http {
server {
listen 443 ssl;
listen [::]:443 ssl;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_certificate ${path};
ssl_certificate_key ${path};
}
}
# XFF (X-Forwarded-For, real_ip)
# https://nginx.org/en/docs/http/ngx_http_realip_module.html
http {
server {
set_real_ip_from ${ip};
real_ip_header X-Forwarded-For;
}
}
'IT > nginx' 카테고리의 다른 글
[nginx] error (0) | 2023.03.29 |
---|
@주니- :: 주니
포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!