环境:CentOS Linux release 7.3.1611 (Core)  Linux localhost.localdomain 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

一.  依赖包安装

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

  

二. 下载相关软件包到/usr/local/src/ 目录下并安装

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
# 依赖pcre库是因为nginx的rewrite重写需要
wget https://zlib.net/fossils/zlib-1.2.11.tar.gz
#安装zlib库是因为gzip 模块需要
wget https://www.openssl.org/source/openssl-1.0.1t.tar.gz
#安装opensssl库是因为nginx的ssl服务依赖,安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及SSL协议。
wget http://nginx.org/download/nginx-1.13.4.tar.gz
#nginx新版本的包 (稳定版)
cd pcre-8.38
./configure
make && make install
cd ..
#pcre库编译安装
cd openssl-1.0.1t
./configure
make && make install
cd ..
##openssl编译安装
cd zlib-1.2.11
./configure
make && make install
cd ..
#zlib库编译安装
cd nginx-1.13.4
./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=/usr/local/src/pcre-8.38 --with-zlib=/usr/local/src/zlib-1.2.11 --with-openssl=/usr/local/src/openssl-1.0.1t
make && make install
#nginx编译安装

/*

注意如果make报错或者./configure报错应该是少了上面的依赖库,

或者你本机的依赖库版本问题,请安装较新的库。

*/

安装完成后配置文件如下:

[root@localhost nginx-1.13.4]# ll /usr/local/nginx/
total 8084
-rw-r--r-- 1 root root 1077 Aug 14 23:02 fastcgi.conf
-rw-r--r-- 1 root root 1077 Aug 14 23:02 fastcgi.conf.default
-rw-r--r-- 1 root root 1007 Aug 14 23:02 fastcgi_params
-rw-r--r-- 1 root root 1007 Aug 14 23:02 fastcgi_params.default
drwxr-xr-x 2 root root 40 Aug 14 23:02 html
-rw-r--r-- 1 root root 2837 Aug 14 23:02 koi-utf
-rw-r--r-- 1 root root 2223 Aug 14 23:02 koi-win
drwxr-xr-x 2 root root 6 Aug 14 23:02 logs
-rw-r--r-- 1 root root 3957 Aug 14 23:02 mime.types
-rw-r--r-- 1 root root 3957 Aug 14 23:02 mime.types.default
-rwxr-xr-x 1 root root 8215208 Aug 14 23:02 nginx
-rw-r--r-- 1 root root 2656 Aug 14 23:02 nginx.conf
-rw-r--r-- 1 root root 2656 Aug 14 23:02 nginx.conf.default
-rw-r--r-- 1 root root 636 Aug 14 23:02 scgi_params
-rw-r--r-- 1 root root 636 Aug 14 23:02 scgi_params.default
-rw-r--r-- 1 root root 664 Aug 14 23:02 uwsgi_params
-rw-r--r-- 1 root root 664 Aug 14 23:02 uwsgi_params.default
-rw-r--r-- 1 root root 3610 Aug 14 23:02 win-utf
[root@localhost nginx-1.13.4]#

我习惯把默认配置文件放到etc下,不更改也一样。

[root@localhost nginx]# cd /usr/local/nginx/
[root@localhost nginx]# mkdir /etc/nginx
[root@localhost nginx]# cp * /etc/nginx/      

三.启动Nginx  并测试

[root@localhost nginx]# /usr/local/nginx/nginx -c /etc/nginx/nginx.conf
[root@localhost nginx]# ps -ef|grep nginx
root 52723 1 0 23:13 ? 00:00:00 nginx: master process /usr/local/nginx/nginx -c /etc/nginx/nginx.conf
nobody 52724 52723 0 23:13 ? 00:00:00 nginx: worker process
root 52726 19602 0 23:13 pts/0 00:00:00 grep --color=auto nginx
[root@localhost nginx]#

测试之前请关闭centos7的防火墙,这个防火墙真的很烦,限制了很多东西。。

[root@localhost nginx]# systemctl stop firewalld.service
[root@localhost nginx]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
[root@localhost nginx]#

输入ip访问~

Centos7 下nginx nginx-1.13.4 安装的更多相关文章

  1. CentOS7下搭建Nginx+PHP7的安装配置

    一.安装编译工具及库文件: yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel 环境要求 nginx是C ...

  2. CentOS7 下使用 Nginx

    update: 2019-03-25 --新增新装 Nginx 的启动.重启.关闭和查看 2019-02-19 --新增 yum 方式快速简单安装 Nginx 2018-09-29 --新增配置文件对 ...

  3. Linux系统:centos7下搭建Nginx和FastDFS文件管理中间件

    本文源码:GitHub·点这里 || GitEE·点这里 一.FastDFS简介 1.基础概念 FastDFS是一个开源的轻量级分布式文件系统,它对文件进行管理,功能包括:文件存储.文件同步.文件上传 ...

  4. centos7下部署nginx与php

    背景介绍 相信读者在看这篇文章之前已经fastcgi,php-fpm有所了解.大概来讲php语言需要fastcgi程序,即php解释器解释,而php解释器需要php-fpm管理器进行调度. 以下对CG ...

  5. centos7 下 apache nginx squid https正向代理 代理服务器

    apache yum install httpd mod_ssl -y vim /etc/httpd/conf.d/ssl.conf Listen https <VirtualHost *:&g ...

  6. centos7下采用Nginx+uwsgi来部署django

    之前写过采用Apache和mod_wsgi部署django,因为项目需要,并且想比较一下Nginx和Apache的性能,尝试采用Nginx+uwsgi的模式来部署django. 1.安装uwsgi以及 ...

  7. 在centos7下搭建nginx环境,并配置负载均衡,最终能达到通过域名直接访问的目的

    1.关于nginx:个人理解的nginx它的主要用途就是负载均衡,当然可能还有其他一些功能可能我们不长用到,我们通过nginx可以干什么呢?为什么要引入它呢?原因是当有高并发访问服务器时,服务器可能会 ...

  8. centos7下搭建nginx+php7.1+mariadb+memcached+redis

    一.环境准备 1.首先介绍一下环境,以及我们今天的主角们 我用的环境是最小化安装的centos7,mariadb(江湖传言mysql被oracle收购后,人们担心像java一样毁在oracle手上于是 ...

  9. centos7 下通过nginx+uwsgi部署django应用

    1. 安装python3.6 1. 获取 wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz tar -xzvf Python- ...

  10. centos7下使用mysql离线安装包安装mysql5.7

    服务器环境: centos7 x64 需要安装mysql5.7+ 一.卸载CentOS7系统自带mariadb # 查看系统自带的Mariadb [root@CDH-141 ~]# rpm -qa|g ...

随机推荐

  1. Folyd + 路径存储

    一.Folyd 算法原理 如果 AB + AC < BC 那么, BC最短路就要经过 A. 在算法进行过程中,应该是 ,B-A 有很多路径,B 代表这些路径权值之和,A-C也有很多路径,C是这些 ...

  2. Centos6_32位系统512M内存_如何安装gogs_Mysql_配置开机自启动

    因为有很多人的Linux版本比较低,内存配置也较低,X86 ,32位系统的:所以这里推荐采用二进制安装gogs,并且使用Mysql:这个是傻瓜式的安装方案,适合绝大多数人(提及了centos7的安装思 ...

  3. shell编程基础-01

    1.1 前言 1.1.1 为什么学Shell Shell脚本语言是实现Linux/UNIX系统管理及自动化运维所必备的重要工具Linux/UNIX系统的底层及基础应用软件的核心大都涉及Shell脚本的 ...

  4. 【转载】 旧版本Microsoft Office正在配置解决方法

    原文:https://blog.csdn.net/sinat_37215184/article/details/81053931 在运行Microsoft Office 2010等旧版本的Office ...

  5. Oracle-两表关联更新和插入

    需求: 表a(com_name,stock_code,com_sacle,mark,market_location,company_name) 表b(com_name,stock_code,com_s ...

  6. openwrt利用openvpn两网互通

    目录 创建证书文件服务器端配置防火墙配置客户端配置uvs-001(远端PC)uvs-002(网关下属设备)测试连接 创建证书文件 安装证书工具 opkg openvpn-easy-rsa 创建证书 b ...

  7. java语言描述 用抽象类模拟咖啡机的工作

    import java.util.Scanner; class Test { public static void main(String[] args) { coffee per = new cof ...

  8. Python3爬虫(十五) 代理

    Infi-chu: http://www.cnblogs.com/Infi-chu/ 一.设置代理 1.urllib #HTTP代理类型 from urllib.error import URLErr ...

  9. VIM Commands

    Vim Commands Commands in NORMAL modes Motions small granular: move by direction k h l j mid granular ...

  10. Java并发编程系列一:Future和CompletableFuture解析与使用

    一.Future模式 Java 1.5开始,提供了Callable和Future,通过它们可以在任务执行完毕之后得到任务执行结果. Future接口可以构建异步应用,是多线程开发中常见的设计模式. 当 ...