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
makemake install4.測试
/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 logs6.2创建文件
cd logs/
touch error.log
touch nginx.pid
7.启动
/usr/local/nginx/nginx
看到
Welcome to nginx!
说明nginx初步启动配置成功了!