linux下安装Nginx
下载nginx: wget http://nginx.org/download/nginx-1.8.0.tar.gz
下载openssl : wget http://www.openssl.org/source/openssl-fips-2.0.9.tar.gz
下载zlib : wget http://zlib.net/zlib-1.2.8.tar.gz
下载pcre : wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
如果没有安装c++编译环境,还得安装,通过yum install gcc-c++完成安装
1.查看原有系统是否已安装Openssl
openssl version -a
2.查看系统是否已安装gcc编译器
gcc -v
3.检查是否已安装zlib库
whereis zlib
如果已安装,会打印出zlib的路径,如果没有打印出路径,则表示没有安装,需要我们下载安装。
linux下编译安装zlib
http://www.zlib.net/
将下载得到的压缩包拷贝到你的linux机器上,进行编译安装
zlib:
[[email protected]]tar zxvf zlib-1.2.8.tar.gz
[[email protected]] cd zlib-1.2.8
[[email protected]] ./configure && make && make install
openssl :
[[email protected]] tar zxvf openssl-fips-2.0.9.tar.gz
[[email protected]] cd openssl-fips-2.0.9
[[email protected]] ./config && make && make install
pcre:
[[email protected]] tar zxvf pcre-8.36.tar.gz
[[email protected]] cd pcre-8.36
[[email protected]] ./configure && make && make install
最后安装nginx
[[email protected]]tar zxvf nginx-1.8.0.tar.gz
[[email protected]] cd nginx-1.8.0
[[email protected]] ./configure && make && make install
接续看下面链接
https://www.cnblogs.com/lovexinyi8/p/5845017.html
报这个错误
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
访问:https://blog.****.net/zyhlearnjava/article/details/71908529
nginx已经启动 无法访问页面
最后发现问题不是出在nginx上,而是出在iptable上,在iptable上添加80端口
#vi /etc/sysconfig/iptables
//在倒数第二行加入80端口
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
//重启iptables
#/etc/init.d/iptables restart
再通过ip访问 ok~ 没问题了