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
$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