您的位置:首页 > 运维架构 > Nginx

centos 6 源码安装nginx

2020-06-29 04:25 1141 查看

源码安装nginx

安装依赖包

[root@localhost ~]# yum -y install gcc gcc-c++ pcre-devel zlib-devel

解压nginx压缩包

  • 我这里用的是1.16.1版本 这个链接有更全的nginx源码包: link.
[root@localhost ~]# tar zxf nginx-1.16.1.tar.gz

检测安装环境,配置安装

[root@localhost ~]# cd nginx-1.16.1
[root@localhost nginx-1.16.1]# ./configure --prefix=/usr/local/nginx
  • –prefix等于的路径是安装路径

编译、安装

[root@localhost nginx-1.16.1]# make && make install

启动、测试

  • 启动完可在浏览器测试 注意关闭防火墙
[root@localhost nginx-1.16.1]# /usr/local/nginx/sbin/nginx
[root@localhost nginx-1.16.1]# service iptables stop
iptables:将链设置为政策 ACCEPT:filter                    [确定]
iptables:清除防火墙规则:                                 [确定]
iptables:正在卸载模块:                                   [确定]
[root@localhost nginx-1.16.1]# setenforce 0
  • 完成界面
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: