Ubuntu16.04.1 安装Nginx的方法

2019-10-17 19:02:03王旭

检查配置文件是否正确

poechant@ubuntu:/usr/local/nginx$ ./sbin/nginx -t

nginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (13: Permission denied)

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

2012/01/09 16:45:09 [emerg] 23898#0: open() "/usr/local/nginx/logs/nginx.pid" failed (13: Permission denied)

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

如果出现如上的提示信息,表示没有访问错误日志文件和进程,可以sudo(super user do)一下:

poerchant@ubuntu:/usr/local/nginx$ sudo ./sbin/nginx -t

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

nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful 

如果显示如上,则表示配置文件正确。否则,会有相关提示。

显示帮助信息

poechant@ubuntu:/user/local/nginx$ ./sbin/nginx -h 

或者:

poechant@ubuntu:/user/local/nginx$ ./sbin/nginx -? 

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持易采站长站。