[root@localhost conf]# /usr/local/nginx/sbin/nginx -V nginx version: nginx/1.12.2 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017 TLS SNI support enabled configure arguments: --user=www --group=www --prefix=/usr/local/nginx-1.12.2 --with-mail_ssl_module --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module
检测Nginx配置文件语法有无问题,推荐启动和重启程序前都测试下。
[root@localhost conf]# /usr/local/nginx/sbin/nginx -t nginx: the configuration file /usr/local/nginx-1.12.2/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx-1.12.2/conf/nginx.conf test is successful
启动Nginx
[root@localhost conf]# /usr/local/nginx/sbin/nginx
重新加载Nginx配置,配置文件修改后利用此命令可以避免重新启动Nginx程序使修改过的配置立即生效
[root@localhost conf]# /usr/local/nginx/sbin/nginx -s reload
停止Nginx
[root@localhost conf]# /usr/local/nginx/sbin/nginx -s stop