nginx systemd service file

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

[Service]
Type=forking
#PIDFile=/run/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/local/nginx/sbin/nginx -s reload -c /usr/local/nginx/conf/nginx.conf
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

nginx 1.18.0 编译安装(Debian 10环境)

#下载nginx 1.18.0源码

wget https://nginx.org/download/nginx-1.18.0.tar.gz

#解压源码包

tar xf nginx-1.18.0.tar.gz

#配置编译参数

cd nginx-1.18.0
./configure --prefix=/usr/local/nginx1180 --user=www --group=www \
--build=x86_64-debian10-linux-gnu --with-select_module \
--with-poll_module --with-threads --with-file-aio \
--with-http_ssl_module --with-http_v2_module --with-http_realip_module \
--with-http_addition_module --with-http_xslt_module=dynamic \
--with-http_image_filter_module=dynamic \
--with-http_geoip_module=dynamic --with-http_sub_module \
--with-http_dav_module --with-http_flv_module \
--with-http_mp4_module --with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_auth_request_module \
--with-http_random_index_module --with-http_secure_link_module \
--with-http_degradation_module --with-http_slice_module \
--with-http_stub_status_module \
--with-http_perl_module=dynamic --with-mail=dynamic \
--with-mail_ssl_module --with-stream=dynamic \
--with-stream_ssl_module --with-stream_realip_module \
--with-stream_geoip_module=dynamic \
--with-stream_ssl_preread_module --with-google_perftools_module \
--with-pcre --with-pcre-jit --with-libatomic

#编译并安装

make
sudo make install