centos7 nginx 安装

别管那么多 先装一堆基础依赖(本次用的着的,用不着的以装别的也可能用的着的)

yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel gcc gcc-c++  openssl-devel
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
yum install  gcc perl-ExtUtils-MakeMaker
  1. 官网下载nginx(找当前的稳定版)
  2. 下载后上传到服务器(scp 就不用写了吧)
  3. 解压并进入目录:tar -xzf nginx-1.16.0.tar.gz cd nginx-1.16.0
  4. 编译安装:
./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --sbin-path=/usr/sbin/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_gzip_static_module --with-http_stub_status_module --with-http_ssl_module --with-pcre --with-file-aio --with-http_realip_module --without-http_scgi_module --without-http_uwsgi_module --without-http_fastcgi_module`
make && make install
  1. nginx 安装到 /usr/local/nginx
  2. 安装好以后修改 nginx.conf 文件进行配置。配置修改后使用测试命令
nginx -t 

出现以下显示为配置文件修改没有错误,可以重新加载配置

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

重新加载配置

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值