Kylian 태그 관리 글쓰기 방명록
2023-11-13 15:22:51

VMware workstation17에 Centos7을 이용해 Nginx 설치해보자!

example VM IP: 10.0.2.33


요약

  1. yum 외부 저장소 추가
  2. yum install
  3. 방화벽 포트 개방
  4. nginx 포트 설정
  5. nginx 데몬 실행
  6. nginx 페이지 확인

1. cd etc/yum.repos.d/ 이동 후 vi nginx.repo 레포지토리 등록(아래 붙여넣기)

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

 

2. Nginx 설치

yum install -y nginx

 

3. 방화벽 포트 개방

firewall-cmd --permanent --add-port=8089/tcp 
firewall-cmd --reload 
firewall-cmd --list-port

 

4. Nginx 포트 설정(8089로 변경)

vi /etc/nginx/conf.d/default.conf 

server { 
    listen       8089;   # 이 부분만 변경
    server_name  localhost;

    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

5. Nginx 데몬 실행

systemctl start nginx 
systemctl enable nginx

 

6. nginx 페이지 확인

인터넷 브라우저에 http://10.0.2.33:8089 검색

Kylian. Designed by bskyvision.