Linux环境下安装nginx

#一般我们都需要先装pcre, zlib,前者为了重写rewrite,后者为了gzip压缩
cd /usr/local/dev
mkdir nginx
cd nginx
mkdir soft
cd soft

#先下载pcre,zlib,openssl,nginx
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
wget http://zlib.net/zlib-1.2.11.tar.gz
wget http://www.openssl.org/source/openssl-1.0.2j.tar.gz
wget http://nginx.org/download/nginx-1.9.9.tar.gz

#安装pcre
tar -zxvf pcre-8.38.tar.gz
cd pcre-8.38
./configure
make
make install

#安装zlib
tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure
make
make install

#安装openssl
tar -zxvf openssl-1.0.2j.tar.gz
cd openssl-1.0.2j
./config
make
make install

#安装nginx
tar -zxvf nginx-1.9.9.tar.gz
cd nginx-1.9.9

# 如果直接执行 ./configure则nginx安装到默认路径,自定义安装步骤如下,安装到/soft/nginx目录
./configure --sbin-path=/soft/nginx/nginx \--conf-path=/soft/nginx/nginx.conf \--pid-path=/soft/nginx/nginx.pid \--error-log-path=/soft/nginx/logs \--with-http_ssl_module \--with-pcre=../pcre-8.38 \--with-zlib=../zlib-1.2.11 \--with-openssl=../openssl-1.0.2j --with-stream

make
make install
#启动nginx
/soft/nginx/nginx -c /soft/nginx/nginx.conf

#查看nginx进程
ps -ef|grep nginx

#关闭nginx
kill -9 进程号

#查看80端口占用情况
netstat -tunlp|grep 80

# 修改防火墙
vim /etc/sysconfig/iptables

添加:

-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT


# 重启防火墙
service iptables restart

#查看安装哪些模块
/soft/nginx/nginx -V | tr ' ' '\n'|grep ssl

转载于:https://www.cnblogs.com/yangfan5157/p/10144374.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值