CentOS 7 - NGINX 1.16 설치
페이지 정보
작성자 상석하대 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 에필로그 댓글 0건 조회 2,064회 작성일 22-06-09 14:56본문
yum -y update
yum -y install wget make gcc gcc-c++
mkdir /opt/install
cd /opt/install
-. 연관 라이브러리 빌드
wget https://zlib.net/zlib-1.2.12.tar.gz
tar zxf zlib-1.2.12.tar.gz
cd zlib-1.2.12
./configure
make
cd ..
wget https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.gz
tar zxf pcre-8.45.tar.gz
cd pcre-8.45
./configure
make
cd ..
yum -y install perl
wget https://www.openssl.org/source/openssl-1.1.1n.tar.gz
tar zxf openssl-1.1.1n.tar.gz
cd openssl-1.1.1n
./config
make
cd..
-. Nginx 설치
useradd --shell /usr/sbin/nologin nginx
wget https://nginx.org/download/nginx-1.16.1.tar.gz
tar zxf nginx-1.16.1.tar.gz
cd nginx-1.16.1
./configure \
--prefix=/usr/local/nginx \
--sbin-path=/usr/local/nginx/sbin/nginx \
--conf-path=/usr/local/nginx/conf/nginx.conf \
--pid-path=/usr/local/nginx/mmc/nginx.pid \
--lock-path=/usr/local/nginx/mmc/nginx.lock \
--error-log-path=/usr/local/nginx/mmc/error.log \
--http-log-path=/usr/local/nginx/mmc/access-log \
--with-zlib=../zlib-1.2.12 \
--with-pcre=../pcre-8.45 \
--with-openssl=../openssl-1.1.1n \
--with-http_ssl_module \
--with-debug \
--user=nginx \
--group=nginx
make
make install
cd ..
-. 설치 확인
/usr/local/nginx/sbin/nginx
curl localhost
-. 방화벽 허용
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
-. 사용자 설정, 변수등록
vi /usr/local/nginx/conf/nginx.conf
user nginx;
vi /etc/profile
export NGINX_HOME=/usr/local/nginx
export PATH=$NGINX_HOME/sbin:$PATH
source /etc/profile
-. 데몬 설정
/usr/local/nginx/sbin/nginx -s stop
vi /etc/systemd/system/nginx.service
[Unit]
Description=NGINX
After=syslog.target network.targetremote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/mmc/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
PrivateTmp=true
[Install]
systemctl daemon-reloadWantedBy=multi-user.target
-. 시작 및 제어
systemctl start nginx.service
systemctl status nginx.service
systemctl enable nginx.service
댓글목록
등록된 댓글이 없습니다.