Nginx經常使用命令之啓動與重啓

一、測試新的Nginx程序是否正確html

[test@P-SH-Nginx-01 nginx]$ ./sbin/nginx -tnginx

nginx: the configuration file /usr/local/openresty/nginx/conf/nginx.conf syntax is okredis

nginx: [emerg] open() "/usr/local/openresty/nginx/logs/access.log" failed (13: Permission denied)json

nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test failedsession

二、啓動Nginxcurl

test@P-SH-Nginx-01 openresty]$ sudo ./nginx/sbin/nginx -c conf/nginx.confxss

/usr/local/nginx/sbin/nginx -t測試

nginx: theconfiguration file /usr/local/nginx/conf/nginx.conf syntax is okui

nginx:configuration file /usr/local/nginx/conf/nginx.conf test issuccessfullua

三、查看Nginx是否已經啓動起來

[test@P-SH-Nginx-01 openresty]$ ps -ef |grep nginx

root      46505      1  0 01:41 ?        00:00:00 nginx: master process ./nginx/sbin/nginx -c conf/nginx.conf

nobody    46506  46505  0 01:41 ?        00:00:00 nginx: worker process

test      46528  28392  0 01:42 pts/0    00:00:00 grep --color=auto nginx

四、查看Ngixn版本及其編譯參數,注意參數是大寫字母V

[test@P-SH-Nginx-01 openresty]$  ./nginx/sbin/nginx -V

nginx version: openresty/1.11.2.5

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: --prefix=/usr/local/openresty/nginx --with-cc-opt=-O2 --add-module=../ngx_devel_kit-0.3.0 --add-module=../echo-nginx-module-0.61 --add-module=../xss-nginx-module-0.05 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.31 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.06 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.10 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.32 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.18 --add-module=../redis2-nginx-module-0.14 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.14 --add-module=../rds-csv-nginx-module-0.07 --with-ld-opt=-Wl,-rpath,/usr/local/openresty/luajit/lib --with-http_stub_status_module --with-http_ssl_module

五、驗證Nginx是否正常運行

[test@P-SH-Nginx-01 openresty]$ curl -I http://127.0.0.1

HTTP/1.1 200 OK

Server: openresty/1.11.2.5

Date: Fri, 15 Dec 2017 01:58:18 GMT

Content-Type: text/html

Content-Length: 562

Last-Modified: Thu, 26 Oct 2017 04:12:11 GMT

Connection: keep-alive

ETag: "59f1609b-232"

Accept-Ranges: bytes

六、重啓Nginx

[test@P-SH-Nginx-01 openresty]$ sudo ./nginx/sbin/nginx -s reload

相關文章
相關標籤/搜索