티스토리 뷰
반응형
nginx.conf 와 default.conf 의 차이점
nginx.conf
vi /etc/nginx/nginx.conf
vim /etc/nginx/nginx.conf
nano /etc/nginx/nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024; //Process가 동시에 처리 가능한 접속자 수
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream; // 웹서버의 기본 Content-Type을 정의한다.
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 /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf // ** 핵심 **
}
default.conf
vi /etc/nginx/conf.d/default.conf
vim /etc/nginx/conf.d/default.conf
nano /etc/nginx/conf.d/default.conf
# nginx 설치 후, default.conf 파일을 연다.
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
nginx.conf
파일 내부를 보면 default.conf 가 include 되어있다.
즉, default.conf는 nginx.conf를 통해 include된 서버 설정관련 파일이며
default2.conf, default3.conf 등 여러 개의 파일을 추가하여 서버관련 설정을 추가로 만들어 포함시킬 수 있다.
결론
많은 이와 관련한 포스팅을 본다면 다른 파일에서 작업하는 개발자들을 볼 수 있는데 사실 어느 방식을 사용해도 문제가 없으며
관리하기 쉬운 방향으로 개발하면 될것이다.
nginx.conf
파일은 Nginx의 핵심 파일이며 default.conf
는 개발자의 목적에 따라 커스텀이 가능한 파일이기
때문에 default 라는 파일명을 유지할 필요는 없으며 http{}
내부에 include 해주기만 하면 된다.
Reference
반응형
'Docker 🐋' 카테고리의 다른 글
이미시 build 시 생성되는 <none> image (0) | 2022.06.22 |
---|---|
Docker - NginX는 왜 인기가 있을까? (0) | 2022.06.21 |
Docker network (0) | 2022.06.19 |
Docker Logging - elk (0) | 2022.06.18 |
쿠버네티스? (0) | 2022.06.17 |
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- nginx
- 자격증
- JPA
- 스프링부트
- java
- springboot
- security
- interview
- ajax
- 자바
- CS
- kakao
- Solid
- C언어
- Spring
- OOP
- docker
- 알고리즘
- Algorithm
- 그래프
- 스프링
- 릿코드
- 매트랩
- Matlab
- spring-cloud
- 면접
- 디자인패턴
- 프로그래머스
- 백준
- 수학
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
글 보관함