1.首先安装依赖包(依赖包有点多,我们采用yum的方式来安装)
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
2.将nginx-1.7.6.tar.gz上传到/usr/local/下
tar -zxvf nginx-1.7.6.tar.gz
3.重命名包名称,讲nginx-1.7.6改为nginx
mv nginx-1.7.6 nginx
3.编译
cd nginx
./configure
make
make install
4.测试
/usr/local/nginx/nginx -t
5.问题:
nginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (2: No such file or directory) 2015/06/06 15:16:28 [emerg] 13663#0: open() "/usr/local/nginx/logs/access.log" failed (2: No such file or directory)
6.解决方案
6.1创建文件夹logs
mkdir logs
6.2创建文件
cd logs/
touch error.log
touch nginx.pid
7.启动
/usr/local/nginx/nginx
看到
Welcome to nginx!
说明nginx初步启动配置成功了!
我的个人网站:http://www.caicongyang.com
我的CSDN博客地址: http://blog.csdn.net/caicongyang
时间: 2024-11-07 17:16:19