nginx的安装:
下载地址:http://nginx.org/download/nginx-1.7.7.tar.gz
-- ./configure --prefix=/user/local/nginx
安装准备:ngnix依赖pcre库,要先安装pcre
yum install pcre
yum install pcre-devel
nginx依赖zlib库,要安装
yum install -y zlib-devel
make && make install
启动naginx
cd /user/local/nginx
....conf 配置文件
....html 网页文件
....logs 日志文件
....sbin 主要二进制程序
--错误
[root@localhost sbin]# ./nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
--不能绑定80端口,80端口已经被占用(有时候自己装了apache,nginx等,更多情况是操作系统自带了apache并作为服务启动)
解决:把占用80端口的软件或服务关闭
查看80端口是否被占用
netstat -antp
pkill -9 进程号
运行
[root@localhost sbin]# ./nginx
转载于:https://my.oschina.net/u/993551/blog/345749