linux安装nginx
一.以防万一先安依赖
1.yum install gcc
gcc另外还有种方法,之后总结
2.yum install pcre-devel
安装过程中出现:
Another app is currently holding the yum lock; waiting for it to exit…
The other application is: yum
Memory : 28 M RSS (426 MB VSZ)
Started: Fri Jan 4 16:20:31 2019 - 07:16 ago
State : Traced/Stopped, pid: 28
解决方法:删除 rm -f /var/run/yum.pid
再次运行
因为我之前直接ctrl+z退出,此时并没有完全退出,仍然在运行(后台),所以还是占用着的(Linux中ctrl+z 、ctrl+c、 ctrl+d区别源自:https://blog.youkuaiyun.com/sxhlovehmm/article/details/41318111)
3.yum install zlib zlib-devel
4.yum install openssl openssl-devel
二.正式下载及安装
cd /usr/local/nginx
//下载tar包
wget http://nginx.org/download/nginx-1.13.7.tar.gz
tar zxvf nginx-1.13.7.tar.g
.configure
make
make install
三.启动
netstat anp //查看占用了80端口的pid
kill -9
whereis nginx
cd XXXXXXX/sbin
./nginx -v //查看版本(是否装好)
启动nginx
大功告成