[Linux] Nginx config

Linux 2018. 2. 18. 21:20

HTTP 모듈?은 세 가지 논리적 블럭을 제공한다.

 - 프로토콜 수준 (http 블럭)
 - 서버 수준 (server 블럭)
 - 요청 URL 수준 (location 블럭) ★

<example>
http
{
server
{
listen 80;
...

location / 
{
...
}

location ~ \.php$
{
...
}
}
...
}

모듈 지시어 : 블록 내에 배치된다?

 - listen <Port> IP?; : 웹사이트용 리스닝 소켓이 사용하는 IP 주소와 포트 설정
    ex: listen 80;
 - root <root>; : 웹파일들이 위치한 루트를 정의
    ex: root /usr/share/nginx/html;
 - index <...>; : 인덱스 파일을 정의한다.
    ex: index index.php index.html index.htm;
 - proxy_pass <URL> : 요청을 해당 URL로 pass 한다.
    ex: proxy_pass http://localhost:8080;


----


/etc/nginx/nginx.conf

위 파일은 아래 디렉토리 내의 conf들을 include한다

/etc/nginx/conf.d/ 그리고 /etc/nginx/sites-available (여기에는 default 파일이 있음)

즉, conf 파일을 분리하여 관리할수 있다



WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/