OS

2022.02.14 16:05

NGINX-1.19.4 Compile 설치

  • 비아웹 오래 전 2022.02.14 16:05 인기
  • 4,702
    0

1. 설치 환경

OS : CentOS Linux release 7.7.1908 (Core)

SELINUX : disabled

테스트 일자 : 2020.11.19

 

2. 패키지 설치

[root@viaweb ~]# yum -y groupinstall "Development Tools"
[root@viaweb ~]# yum install -y wget libxml2-devel libxml2-static libxslt libxslt-devel gd gd-devel

3. 소스 다운로드

[root@viaweb ~]# cd /usr/local/src [root@viaweb src]# wget https://nginx.org/download/nginx-1.19.4.tar.gz
[root@viaweb src]# tar xzf nginx-1.19.4.tar.gz [root@viaweb src]# cd nginx-1.19.4
[root@viaweb nginx-1.19.4]# ./configure \ --prefix=/usr/local/nginx \ --conf-path=/usr/local/nginx/conf/nginx.conf \ --sbin-path=/usr/local/nginx/sbin/nginx \ --lock-path=/usr/local/nginx/nginx.lock \ --pid-path=/usr/local/nginx/nginx.pid \ --http-client-body-temp-path=/usr/local/nginx/tmp/body \ --http-proxy-temp-path=/usr/local/nginx/tmp/proxy \ --http-fastcgi-temp-path=/usr/local/nginx/tmp/fastcgi \ --http-uwsgi-temp-path=/usr/local/nginx/tmp/uwsgi \ --http-scgi-temp-path=/usr/local/nginx/tmp/scgi \ --http-log-path=/var/log/nginx/access.log \ --error-log-path=/var/log/nginx/error.log \ --with-http_addition_module \ --with-http_degradation_module \ --with-http_flv_module \ --with-http_image_filter_module \ --with-http_mp4_module \ --with-http_random_index_module \ --with-http_ssl_module \ --with-http_stub_status_module \ --with-http_sub_module \ --with-http_realip_module \ --with-http_xslt_module \ --with-debug \ --with-compat \ --with-perl=/usr/bin/perl \ --with-http_gunzip_module \ --with-http_gzip_static_module \ --with-http_dav_module \ --with-http_auth_request_module \ --user=nginx --group=nginx [root@viaweb nginx-1.19.4]# make && make install

5. 기타설정 및 /etc/init.d/nginx 스크립트 작성

[root@viaweb nginx-1.19.4]# mkdir -p /usr/local/nginx/tmp/body [root@viaweb nginx-1.19.4]# ln -s /usr/local/nginx/sbin/* /usr/bin/
-- vi /etc/init.d/nginx -- # !/bin/sh # Author:Ryan Norbauer http://norbauerinc.com # Modified : Geoffrey Grosenbach http://topfunky.com # Modified : Clment NEDELCU # Reproduced with express authorization from its contributors # chkconfig:3458515 set -e PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DESC="nginx daemon"NAME=nginx DAEMON=/usr/local/nginx/sbin/$NAME # if daemon file not exist, script stop test -x $DAEMON|| exit 0d_start(){ $DAEMON|| echo -n "already running"}d_stop(){ $DAEMON-s quit || echo -n "not running"}d_reload(){ $DAEMON-s reload || echo -n "could not reload"}case"$1"in start) echo -n "Starting $DESC : $NAME" d_start echo ".";; stop) echo -n "Stopping $DESC : $NAME" d_stop echo ".";; reload) echo -n "Reloading $DESC configuration..." d_reload echo "reloaded.";; restart) echo -n "Restarting $Desc : $NAME" d_stop sleep 2 d_start echo ".";;*) echo "Usage : $SCRIPTNAME {start|stop|restart|reload}">&2 exit 3 ll esac exit 0
-- vi /etc/init.d/nginx -- [root@viaweb nginx-1.19.4]# chmod +x /etc/init.d/nginx

6. 데몬 자동실행 등록

[root@viaweb nginx-1.19.4]# chkconfig --add nginx [root@viaweb nginx-1.19.4]# chkconfig nginx on

7. NGINX 구동 명령어

service nginx start (시작) service nginx stop (중지) service nginx restat (재시작)

cf. 서비스 설정 후 firewalld 나 iptables 허용 해주셔야 원격 서비스 가능합니다.

 

감사합니다.

서버호스팅 비아웹

 

  • 공유링크 복사
  • 이전글MRTG-2.17.7 설치2022.02.14
  • 다음글CentOS 5.X iptables_GeoIP Install2022.02.14
  • 댓글목록

    등록된 댓글이 없습니다.