官方版本列表:http://nginx.org/download/

1.安装

wget http://nginx.org/download/nginx-1.10.3.tar.gz
tar -zxvf nginx-1.10.3.tar.gz
cd nginx-1.10.3
./configure
make && make install

编译时添加模块

./configure --with-http_stub_status_module --with-http_ssl_module

*./configure: error: the HTTP rewrite module requires the PCRE library 解决方案

yum -y install pcre-devel

*./configure: error: SSL modules require the OpenSSL library. 解决方案

yum -y install openssl openssl-devel

* ./configure: error: C compiler cc is not found 解决方案

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

* make: *** No rule to make target `build', needed by `default'.  Stop. 解决方案:

yum -y install make zlib-devel gcc-c++ libtool openssl openssl-devel

2.配置

* 配置文件路径(可能不一样)/usr/local/nginx/conf/nginx.conf

#配置服务
vi /lib/systemd/system/nginx.service
[Unit]
Description=nginx
After=network.target [Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx reload
ExecStop=/usr/local/nginx/sbin/nginx quit
PrivateTmp=true [Install]
WantedBy=multi-user.target
#创建服务
systemctl enable nginx.service
#常用命令
systemctl start nginx.service #启动nginx
systemctl stop nginx.service #结束nginx
systemctl restart nginx.service #重启nginx

3.防火墙配置

端口放行:

firewall-cmd --zone=public --list-ports  #查询放行的端口
firewall-cmd --zone=public --add-port=80/tcp --permanent #新增放行端口(80端口)
firewall-cmd --reload #一定要重启防火墙

或者直接关闭防火墙:

systemctl stop firewalld.service
systemctl disable firewalld.service

附:

配置文件编辑

vi /usr/local/nginx/conf/nginx.conf 

https://blog.csdn.net/testcs_dn/article/details/51461750

https://www.cnblogs.com/karrya/p/11851496.html

https://www.cnblogs.com/czlun/articles/7010601.html

https://blog.csdn.net/testcs_dn/article/details/51461999

https://www.cnblogs.com/yan-zm/p/12217118.html

Centos 7 安装nginx指定版本的更多相关文章

  1. Centos8 Yum 安装Nginx指定版本

    查看系统和EPEL的nginx版本   dnf info nginx 通过官方 yum 源安装nginx       vi /etc/yum.repos.d/nginx.repo 列出所有版本    ...

  2. 删:Centos 7安装Nginx 1.8

    [CentOS 7] 安装nginx! 首先进行 nginx yum Nginx安装记录 注意:如果用源码安装,nginx配置时需要指定--with-pcer对应的压缩包路径,如果使用二进制安装不需要 ...

  3. CentOS下安装Nginx并添加nginx_upload_module

    安装前,最好能保证依赖的系统软件已经升级.    yum update CentOS上安装Nginx,如果只是简单安装,不附加其他第三方模块,一句话可以搞定:    yum install nginx ...

  4. linux/centos下安装nginx(rpm安装和源码安装)详细步骤

    Centos下安装nginx rpm包                                                                                 ...

  5. CentOS 7安装nginx

    CentOS 7安装nginx 参考网上其他文章做的 安装Nginx 我们从nginx官方的RPM源来安装一个预构建的稳定版本的nginx包. rpm --import http://nginx.or ...

  6. Linux下yum安装MySQL yum安装MySQL指定版本

    yum安装MySQL 1. 查看有没有安装过     yum list installed MySQL* (有存在要卸载yum remove MySQL*)     rpm -qa | grep my ...

  7. CentOS7 yum 安装 Nginx最新版本

    CentOS7 yum 安装 Nginx最新版本 下载对应当前系统版本的nginx包(package) # wget  http://nginx.org/packages/centos/7/noarc ...

  8. composer安装laravel指定版本

    版权声明:本文为博主原创文章,未经博主允许不得转载. http://blog.csdn.net/qq_38125058/article/details/79126051 首先安装composer,附安 ...

  9. CentOS 7 安装 Nginx 配置反向代理

    Linux使用Nginx Yum存储库上安装Nginx,适用于Red Hat Enterprise Linux和CentOS系统. 1.添加设置Nginx Yum存储库 在CentOS中首次安装Ngi ...

随机推荐

  1. maven仓库和镜像

    目录 简介 本地仓库 远程仓库 远程仓库的更新 远程仓库的认证 部署到远程仓库 快照版本 依赖解析 镜像 本文主要是针对<maven实战>书中关键知识点的学习记录,未免有纰漏或描述不到之处 ...

  2. ubuntu 安装 docker 并配置镜像加速(使用 apt-get 进行安装)

    ubuntu 安装docker CentOS docker安装 https://blog.csdn.net/weixin_44953227/article/details/108597310 你需要这 ...

  3. 【SpringBoot】Spring Boot,开发社区讨论交流网站首页。

    初识Spring Boot,开发社区讨论交流网站首页. 文章目录 初识Spring Boot,开发社区讨论交流网站首页. 1.项目简介 2. 搭建开发环境 JDK Apache Maven Intel ...

  4. ctfhub技能树—web前置技能—http协议—基础认证

    打开靶机环境 下载附件后发现是常用密码字典,于是考虑本题可能是考察密码爆破 打开环境 发现需要认证,于是考虑使用暴力破解 使用burpsuite抓包,查看 发现最下面一行有加密后的密文 使用base6 ...

  5. 使用Azure Runbook 发送消息到Azure Storage Queue

    客户需要定时发送信息到Azure Storage Queue,所以尝试使用Azure Runbook实现这个需求. 首先新增一个Azure Automation Account的资源. 因为要使用Az ...

  6. mysql(视图 事务 索引 外键)

    视图   视图本质就是对查询的封装   创建视图(定义视图 起名以v_开头) create view v_students as select classes.name as c_name ,stud ...

  7. Failed to start ssh.service: Unit not found.

    Failed to start ssh.service: Unit not found. 报错内容: [Centos7@localhost ~]$ service ssh start Redirect ...

  8. 向HDFS中上传任意文本文件,如果指定的文件在HDFS中已经存在,由用户指定是追加到原有文件末尾还是覆盖原有的文件

    1 import java.io.FileInputStream; 2 import java.io.IOException; 3 import java.util.Scanner; 4 5 impo ...

  9. 浅析 record 使用场景

    浅析 record 使用场景 Intro 之前我们有介绍过 record 基本知识,record 会实现基于值的类型比较,最近遇到的几个问题觉得用 record 来解决会非常方便,分享一下 基于值的类 ...

  10. 「一本通 1.3 例 4」Addition Chains

    Addition Chains 题面 对于一个数列 \(a_1,a_2 \dots a_{m-1},a_m\) 且 \(a_1<a_2 \dots a_{m-1}<a_m\). 数列中的一 ...