nugawiki

./categories/os

CentOS 7 NGINX 설치

업데이트 2026-07-21 조회수

1. yum repo

vi /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1

2. 설치

yum install -y nginx

3. 방화벽 (listen과 동일 포트)

firewall-cmd --permanent --zone=public --add-port=8080/tcp
firewall-cmd --reload
firewall-cmd --list-ports

4. 포트 (/etc/nginx/conf.d/default.conf)

server {
    listen       8080;
    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;
    }
}

5. 실행

systemctl start nginx
systemctl enable nginx

확인: http://localhost:8080

./comments