- 先按照这个文章安装
http://www.cnblogs.com/hanyinglong/p/5102141.html - 遇到错误查看
http://blog.csdn.net/zhilong002/article/details/51673614 - 遇到如下错误
-rwxr-xr-x 1 root root 3681442 Jan 17 20:46 nginx
[root@izwz9i3tptmkx0jghts70sz sbin]# ./nginx -t
nginx: the configuration file /usr/local/nginx//conf/nginx.conf syntax is ok
nginx: [emerg] getpwnam("www") failed
nginx: configuration file /usr/local/nginx//conf/nginx.conf test failed
- 解决办法
错误的原因是没有创建www这个用户,应该在服务器系统中添加www用户组和用户www,如下命令:
/usr/sbin/groupadd -f www
/usr/sbin/useradd -g www www
5.成功
[root@izwz9i3tptmkx0jghts70sz 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