CentOS 에 Nginx 설치

2393 단어
공식 문서:https://nginx.org/en/linux_packages.html#RHEL-CentOS
 
설치 환경: Linux 서버 CentOS 7.3, Root 권한
 
1、Install the prerequisites:
sudo yum install yum-utils

 
2、To set up the yum repository, create the file named /etc/yum.repos.d/nginx.repo with the following contents:
(OS 버 전 교체 주의: $releasever, 예 를 들 어 centos 버 전이 7 이면 7 로 교체)
명령:
vim 로 nginx. repo 파일 편집 하기
vim /etc/yum.repos.d/nginx.repo

Nginx 의 yum 원본 설정:
다음 내용 을 nginx. repo 파일 에 붙 여 넣 습 니 다.
[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

vim 명령 입력 :wq 저장 및 종료
 
3、To install nginx, run the following command:
sudo yum install nginx

중간 에 y 를 입력 하여 설치 확인
 
4、When prompted to accept the GPG key, verify that the fingerprint matches 573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62, and if so, accept it.
마지막 으로 fingerprint 를 출력 합 니 다. 위의 빨간색 부분 과 일치 하면 y 를 입력 하여 확인 합 니 다.
 
5 、 시작 | 정지 | 다시 시작 Nginx:
#   
systemctl start nginx.service

#   
systemctl stop nginx.service

#   
systemctl restart nginx.service

 
6. Nginx 의 모든 설치 위치 보기:
rpm 는 Liux 의 rpm 패키지 관리 도구 입 니 다. - q 는 문의 모드 를 대표 하고 - l 은 목록 을 되 돌려 줍 니 다.
rpm -ql nginx

 
7. Nginx 프로필:
/etc/nginx/conf.d
/etc/nginx/conf.d/default.conf

좋은 웹페이지 즐겨찾기