5.启动
$ /usr/local/nginx/sbin/nginx
检查是否启动成功:
打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功。
部分命令如下:
重启:
$ /usr/local/nginx/sbin/nginx –s reload
停止:
$ /usr/local/nginx/sbin/nginx –s stop
/usr/local/nginx/sbin/nginx –s quit
测试配置文件是否正常:
$ /usr/local/nginx/sbin/nginx –t
强制关闭:
-
$ pkill nginx
查看nginx版本:
nginx -v
查看原有nginx的配置参数 查看nginx编译安装时的命令,安装了哪些模块
nginx -V
/usr/local/webserver/nginx/sbin/nginx -V
/usr/local/nginx/sbin/nginx -h
nginx version: nginx/1.14.0
Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives]
Options:
-?,-h : this help 显示该帮助信息
-v : show version and exit 打印版本号并退出
-V : show version and configure options then exit 打印版本号并退出
-t : test configuration and exit 测试配置正确性并退出
-T : test configuration, dump it and exit
-q : suppress non-error messages during configuration testing 测试配置时只显示错误
-s signal : send signal to a master process: stop, quit, reopen, reload 向主进程发送信号
-p prefix : set prefix path (default: /etc/nginx/) 指定nginx服务器路径前缀
-c filename : set configuration file (default: /etc/nginx/nginx.conf) 指定nginx配置文件路径
-g directives : set global directives out of configuration file 指定nginx附加配置文件路径