centos7安裝openrestynginx
cd /usr/local/src/openresty yum -y install pcre-devel openssl openssl-devel yum install -y gcc gcc-c++ zlib-devel pcre-devel openssl-devel readline-devel wget https://openresty.org/download/openresty-1.9.7.5.tar.gz tar xzvf openresty-1.9.7.5.tar.gz cd openresty-1.9.7.5 ./configure --prefix=/usr/local/openresty --with-luajit --with-http_iconv_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module gmake && gmake install #### start /usr/local/openresty/nginx/sbin/nginx -p /data/www/src/online/ #### reload /usr/local/openresty/nginx/sbin/nginx -p /data/www/src/online/ -s reload
systemd啓動nginx多應用文件進程c++
more /usr/lib/systemd/system/nginx.service
centos
[Unit] Description=The NGINX HTTP and reverse proxy server [Service] ExecStart=/root/start.sh [Install] WantedBy=multi-user.target
nginx多應用文件啓動腳本bash
more /root/start.sh #!/bin/bash /usr/local/openresty/nginx/sbin/nginx -c /data/www/src/online/conf/nginx.conf -t /usr/local/openresty/nginx/sbin/nginx -c /data/www/src/online_gray/conf/nginx.conf -t /usr/local/openresty/nginx/sbin/nginx -c /data/www/src/online/conf/nginx.conf /usr/local/openresty/nginx/sbin/nginx -c /data/www/src/online_gray/conf/nginx.conf
chmod +x /root/start.shide
systemctl daemon-reload #生效配置文件重載
systemctl enable nginx.service #設置開機啓動
systemctl list-unit-files |grep nginx #查看nginx應用開機狀態
systemctl start nginx.service #查看nginx應用啓動狀態
systemctl status nginx.service lua
systemd配置nginx開機啓動centos7
more /usr/lib/systemd/system/nginx.service
rest
[Unit] Description=The NGINX HTTP and reverse proxy server [Service] Type=forking ExecStartPre=/usr/local/openresty/nginx/sbin/nginx -c /data/www/src/online/conf/nginx.conf -t ExecStart=/usr/local/openresty/nginx/sbin/nginx -c /data/www/src/online/conf/nginx.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target