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.1.编译
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初步启动配置成功了!
ubuntu 15.04手动安装nginx 1.9.0:http://www.linuxdiyf.com/linux/12038.html
Ubuntu 14.10下源码编译安装Nginx 1.8.0:http://www.linuxdiyf.com/linux/12222.html
在Ubuntu,Linux Mint上安装Nginx 1.6.0:http://www.linuxdiyf.com/linux/10613.html
CentOS 6.3安装Nginx:http://www.linuxdiyf.com/linux/12123.html
CentOS上安装Nginx报错解决一例:http://www.linuxdiyf.com/linux/10152.html