728x90
1. 비번 변경
passwd
2. 유틸 설치
yum install yum-utils
3. Repository 설정
vi /etc/yum.repos.d/nginx.repo
nginx pacakge 받으려면
텍스트로 받을 설정 해놓고 보내야함
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
4. nginx 설치
yum -y install nginx
5. 홈으로 사용할 디렉토리를 생성하고, 해당 디렉토리의 소유권을 설정
~# mkdir -p /ncp/data/www
~# chown -R nginx:nginx /ncp/data/www
~# cp /usr/share/nginx/html/index.html /ncp/data/www/index.html
~# ls -al /ncp/data/www
6. 환경설정
vi /etc/nginx/conf.d/default.conf
7. conf 수정
# 변경 전
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
# 변경 후
root /ncp/data/www;
index index.html index.htm;
location / {
try_files $uri $uri/ = 404;
}
# 변경 전
#error_page 404 /404.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# 변경 후
error_page 404 /404.html;
location = /50x.html {
root /ncp/data/www;
}
8. nginx 실행
~# systemctl start nginx
~# systemctl status nginx
오류를 만나서 자기전에 30분간 헤메었다.
그 이유는 ..
자세히 읽어보니 /50x.html 에 대한 내용이 duplicate였다.
밑에껄 주석처리하고 재시작하니 된다!
'서버' 카테고리의 다른 글
nas에 웹애플리케이션 배포하기 - 2) docker의 spring 셋팅 및 war 말아서 넣기 (0) | 2023.11.16 |
---|---|
nas에 웹애플리케이션 배포하기 - 1) docker, tomcat, mariadb 설치 및 셋팅 (heidsql 접근하기) (0) | 2023.11.16 |
nas에 웹애플리케이션 배포하기 - 0) docker위에 tomcat war배포하기 (0) | 2023.11.16 |
iwinv - 서버 호스팅하기 (0) | 2023.11.06 |
프론트(nginx) + 백엔드(tomcat, springboot) cors 해결과정 (0) | 2023.09.26 |