Nginx 1.18.0 source install with openssl on CentOS8

CentOS8에서 nginx 1.18.0 & openssl 1.1.1g로 source install 하는 방법을 기술합니다.

Enviroment
OS : CentOS 8.1
Nginx : 1.18.0
Openssl : 1.1.1g

openssl 설치는 아래의 글을 참고하시면 됩니다.

https://umount.net/openssl-1-1-1g-source-install-on-centos8/

 

1. Default Enviroment Setting

$sudo dnf install tar wget
$sudo mkdir -p /usr/local/IDC/Src
$sudo mkdir -p /usr/local/IDC/Download
$sudo mkdir -p /usr/local/IDC/Service
$sudo mkdir -p /usr/local/IDC/Data
일반적인 설치는 centos8 부터 적용된 dnf 를 사용하여 각 폴더의 용도는 다음과 같습니다.
Download – Source File 위치
Src – Source compile prefix 위치 ( 서비스명 + 버전명 표시 )
Service – Symbolic Src 위치 ( 서비스명 표시 )
 
2. Requirement package install
$sudo dnf install gcc gcc-c++ pcre-devel zlib-devel libjpeg-devel libpng-devel freetype-devel gd-devel

3. Create user & group

$sudo groupadd nginx -g 3001
$sudo useradd -u 3001 -g 3001 -s /sbin/nologin -c "Nginx" -M nginx

4. Download & Install

$sudo cd /usr/local/IDC/Download
$sudo curl -O http://nginx.org/download/nginx-1.18.0.tar.gz $sudo tar xfpvz nginx-1.18.0.tar.gz $sudo cd nginx-1.18.0 $sudo ./configure --prefix=/usr/local/IDC/Src/nginx-1.18.0 --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --error-log-path=/usr/local/IDC/Src/nginx-1.18.0/logs/error.log --http-log-path=/usr/local/IDC/Src/nginx-1.18.0/logs/access.log --http-client-body-temp-path=/usr/local/IDC/Src/nginx-1.18.0/tmp/client/ --http-proxy-temp-path=/usr/local/IDC/Src/nginx-1.18.0/tmp/proxy/ --http-fastcgi-temp-path=/usr/local/IDC/Src/nginx-1.18.0/tmp/fcgi/ --with-http_realip_module --with-http_stub_status_module --with-cc-opt="-I /usr/include/pcre" --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-openssl=/usr/local/IDC/Download/openssl-1.1.1g --user=nginx --group=nginx $sudo make -j$(nproc) $sudo make install $sudo mkdir -p /usr/local/IDC/Src/nginx-1.18.0/tmp

5. Symbolic directory

$sudo cd /usr/local/IDC/Service/
$sudo ln -s /usr/local/IDC/Src/nginx-1.18.0/ /usr/local/IDC/Service/nginx

6. Create nginx systemd

vi /etc/systemd/system/nginx.service

[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
Environment=LD_LIBRARY_PATH=/usr/local/IDC/Service/openssl/lib
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/local/IDC/Service/nginx/sbin/nginx -t
ExecStart=/usr/local/IDC/Service/nginx/sbin/nginx
ExecReload=/usr/local/IDC/Service/nginx/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
ExecStopPost=/bin/rm -f /var/run/nginx.pid
PrivateTmp=true

[Install]
WantedBy=multi-user.target

7. Enable nginx & Start

$sudo systemctl enable nginx.service
$sudo systemctl start nginx.service

You may also like...

Subscribe
Notify of
guest

이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.

0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x