centos7安装nginx-离线包

下载

官方下载地址 http://nginx.org/en/download.html

选择稳定版本Stable version安装

http://nginx.org/download/nginx-1.14.2.tar.gz
图1

安装

centos7

一、基础依赖安装

yum install -y gcc gcc-c++ automake autoconf libtool make

yum install -y pcre2 zlib openssl openssl-devel

安装好后nginx就不需要依赖pcre2 zlib openssl源码了

二、安装nginx

cd nginx-1.14.2 #进入nginx目录

./configure # 配置

make && make install # 编译安装

如上没有指定安装目录,默认安装路径 /usr/local/nginx/下

nginx中文网配置参考,配置了指定路径

wget http://nginx.org/download/nginx-1.4.2.tar.gz

tar -zxvf nginx-1.4.2.tar.gz

cd nginx-1.4.2

./configure --sbin-path=/usr/local/nginx/nginx \

--conf-path=/usr/local/nginx/nginx.conf \

--pid-path=/usr/local/nginx/nginx.pid \

--with-http_ssl_module \

--with-pcre=/opt/app/openet/oetal1/chenhe/pcre-8.37 \

--with-zlib=/opt/app/openet/oetal1/chenhe/zlib-1.2.8 \

--with-openssl=/opt/app/openet/oetal1/chenhe/openssl-1.0.1t

make

make install

三、查看是否安装成功

  1. 方法一

cd /usr/local/nginx/sbin; ./nginx -t

显示内容如下,则安装成功

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

  1. 方法二

./nginx 启动nginx

查看页面 指定的主机和端口就可以访问到nginx的页面即可,如安装主机为 192.168.72.100端口80

直接访问 : http://192.168.72.100:80 有nginx的默认页面即Welcome to nginx!为安装成功
nginx欢迎页

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值