01. 系统版本
# cat /etc/redhat-release
02.NGINX 编译安装
001. 下载地址 : nginx.org
002. 建议选择stable (稳定版本)
003. 单击stable 版本 后进入下载页面 》》 右击stable版本中最新版本,选择‘复制链接地址‘
004. 进入linux 服务器:
# cd /usr/src
# wget http://nginx.org/download/nginx-1.11.10.tar.gz -- 进行下载
# tar xvf nginx-1.11.10.tar.gz ---将NGINX源码包解压到本地
# cd nginx-1.11.10/ && ./configure --prefix=/usr/local/nginx
此处若遇到报错,例如:
报错信息提示缺少 PCRE库
# yum install pcre pcre-devel -y
# ./configure --prefix=/usr/local/nginx
# make && make install
# cd /usr/local/nginx
目录简介:
/usr/local/nginx
- conf 配置文件主目录
- html 网页文件
- logs 日志文件
- sbin 主二进制文件
# cd sbin
# ./nginx ---- 启动nginx (若报类似 "bind() to 0.0.0.0:80 failed (98:Address alread in use)" 错误提示很明显,80端口被占用)
80端口被占用排错过程,关闭占用80 端口的进程:
注释: netstat命令中 p选项是查出占用80端口的进程号,若发现此进程可以强制杀掉
# pkill -9 httpd
# cd /usr/local/nginx/sbin
# ./nginx ----启动nginx
# ./nginx -t (检查nginx 配置是否正确)
原文:http://www.cnblogs.com/zhangrzh/p/6502040.html