nginx 서버 배치 절차
3273 단어 프로그래머 노트
운영 체제: CentOS 7.7 64 비트
컴 파일 도구 및 라 이브 러 리 파일 설치
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
일단 PCRE 를 설치 해 야 돼 요.
PCRE 설치 패키지 다운로드:
cd /usr/local/src/
wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
압축 해제 패키지:
tar zxvf pcre-8.35.tar.gz
설치 패키지 디 렉 터 리 에 들 어가 기:
cd pcre-8.35
컴 파일 설치:
./configure
make && make install
pcre 버 전 보기:
pcre-config --version
>>>8.35
Nginx 설치
다운로드 Nginx:
cd /usr/local/src/
wget http://nginx.org/download/nginx-1.6.2.tar.gz
압축 해제 패키지:
tar zxvf nginx-1.6.2.tar.gz
설치 패키지 디 렉 터 리 에 들 어가 기:
cd nginx-1.6.2
컴 파일 설치:
./configure --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35
make && make install
nginx 버 전 보기:
/usr/local/webserver/nginx/sbin/nginx -v
>>>nginx version: nginx/1.6.2
nginx 설정 성공 여부 테스트
브 라 우 저 서버 도 메 인 이름 입력 (예:http://39.97.118.212) 성공 을 표시 하 는 nginx 페이지 에 오신 것 을 환영 합 니 다
프로필 보기:
cat /usr/local/webserver/nginx/conf/nginx.conf
백업 파일 생 성:
cp /usr/local/webserver/nginx/conf/nginx.conf /usr/local/webserver/nginx/conf/nginx.backup.conf
프로필 수정:
vi /usr/local/webserver/nginx/conf/nginx.conf
--------------------------------------------------------------------------> location / { root html; index index.html index.htm; } --------------------------------------------------------------------------> || || || / location / { root /opt/projects/dist/article/; index index.html index.htm; }
nginx: / usr / local / webserver / nginx / sbin / nginx - s 재 부팅
nginx 일반 명령
:/usr/local/webserver/nginx/sbin/nginx
:/usr/local/webserver/nginx/sbin/nginx -s reload
:/usr/local/webserver/nginx/sbin/nginx -s stop
:ps -ef | grep nginx