VMware workstation17에 Centos7을 이용해 Nginx 설치해보자!
example VM IP: 10.0.2.33
요약
- yum 외부 저장소 추가
- yum install
- 방화벽 포트 개방
- nginx 포트 설정
- nginx 데몬 실행
- 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 검색
'주요 개념 > 리눅스' 카테고리의 다른 글
[Linux] 리눅스 VI / VIM 편집기 (1) | 2023.11.30 |
---|---|
Linux 리눅스 프로세스 확인 명령어(ps, ps -ef, grep) (0) | 2023.11.18 |
사용자 계정 (0) | 2023.06.14 |