*사용환경 : CentOs 7
$ useradd nginx
$ mkdir -p /app/nginx/src /applog/nx_log
$ sudo chown -R root:root /app/nginx
$ cd /app/nginx/src/nginx-1.18.0
$ ./configure --prefix=/app/nginx/nginx118 --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --http-client-body-temp-path=/var/lib/nginx/body --http-proxy-temp-path=/var/lib/nginx/proxy --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --http-scgi-temp-path=/var/lib/nginx/scgi --http-log-path=/applog/nx_log/access.log --error-log-path=/applog/nx_log/error.log --with-http_ssl_module --with-http_realip_module --with-http_stub_status_module
$ sudo make && sudo make install
#configuration option
--prefix=PATH #set installation prefix
--pid-path=PATH #set nginx.pid pathname
--lock-path=PATH #set nginx.lock pathname
--user=USER #set non-privileged user for worker processes
--group=USER #set non-privileged group for worker processes
--http-client-body-temp-path=/var/lib/nginx/body #set path to store http client request body temporary files
--http-proxy-temp-path=/var/lib/nginx/proxy #set path to store http proxy temporary files
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi #set path to store http fastcgi temporary files
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi #set path to store http uwsgi temporary files
--http-scgi-temp-path=/var/lib/nginx/scgi #set path to store http scgi temporary files
--http-log-path=PATH #set http access log pathname
--error-log-path=PATH #set error log pathname
--with-http_ssl_module #enable ngx_http_ssl_module
--with-http_realip_module #enable ngx_http_realip_module
--with-http_stub_status_module #enable ngx_http_stub_status_module
$ sudo chown -R nginx:nginx /app/nginx /applog/nx_log
$ cd /nginx/nginx118/sbin
$ sudo chown root:sys nginx
$ sudo chmod ug+s nginx
$ sudo vi /app/nginx/nginx118/conf/nginx.conf
$ sudo mkdir -p /var/lib/nginx/body
$ sudo vi /etc/systemd/system/nginx.service
$ sudo systemctl enable nginx.service
$ sudo systemctl start nginx.service
#nginx.service
[Unit]
Description=The NGINX HTTP and reserve proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/app/nginx/nginx118/sbin/nginx -t
ExecStart=/app/nginx/nginx118/sbin/nginx
ExecReload=/app/nginx/nginx118/sbin/nginx -s reload
ExecStop=/app/nginx/nginx118/sbin/nginx -s stop
PrivateTmp=true
[Install]
WantedBy=multi-user.target