系统环境

操作系统:64位CentOS Linux release 7.2.1511 (Core)

安装nginx依赖包

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

必须要安装,时间可能有点久。

下载nginx

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

下载最新的nginx-1.13.6(写笔记时,这个版本是最新的),下载好之后,在centos系统中创建/soft目录

[root@localhost ~]# mkdir /soft

利用工具WinSCP,将下载好的nginx包拷贝到centos下的/soft目录

解压nginx

[root@localhost ~]# cd /soft

[root@localhost soft]# tar -zxvf nginx-1.13.6.tar.gz

编译和安装nginx

[root@localhost soft]# cd nginx-1.13.6/

[root@localhost nginx-1.13.6]# ./configure --prefix=/usr/local/nginx

指定安装在/usr/local/nginx目录下,不指定也没关系,默认就是这个目录。

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

查看nginx版本号:

[root@localhost ~]# cd /usr/local/nginx/sbin/

[root@localhost sbin]# ./nginx -h

开启80端口

[root@localhost conf]# firewall-cmd --zone=public --add-port=80/tcp --permanent

[root@localhost conf]# firewall-cmd --reload

启动和停止nginx

启动

[root@localhost sbin]# ./nginx

停止

[root@localhost sbin]# ./nginx -s stop

重启

[root@localhost sbin]# ./nginx -s reload

浏览

在浏览器地址栏输入http://192.168.1.100/

参考网址

https://www.cnblogs.com/lxg0/p/6979274.html

简单配置

下面这段配置是最最最简单的负载均衡配置,文件名nginx_fzjh.conf,只要在我们启动nginx的时候,指定这个配置文件就行了([root@localhost sbin]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx_fzjh.conf)

worker_processes 4;
events{
worker_connections 1024;
} http{
server {
listen 80;
server_name myserver; location / {
proxy_pass http://mysite;
}
} upstream mysite {
#ip_hash;
server 10.101.56.52:80;# weight=5;
server 10.101.56.52:8089;# weight=3;
#server x.x.x.x:80 weight=1;
}
}

只看不回复,诅咒你钉钉0.0000000001厘米。

centos7安装nginx-1.13.6 新手入门,图文解析的更多相关文章

  1. centos7安装kafka_2.11-1.0.0 新手入门

    系统环境 1.操作系统:64位CentOS Linux release 7.2.1511 (Core) 2.jdk版本:1.8.0_121 3.zookeeper版本:zookeeper-3.4.9. ...

  2. linux(centos7) 安装nginx

    linux(centos7) 安装nginx 1.14(stable) 版本 Nginx配置文件常见结构的从外到内依次是「http」「server」「location」等等,缺省的继承关系是从外到内, ...

  3. 【Nginx安装】CentOS7安装Nginx及配置

    [Nginx安装]CentOS7安装Nginx及配置 2018年03月05日 11:07:21 阅读数:7073 Nginx是一款轻量级的网页服务器.反向代理服务器.相较于Apache.lighttp ...

  4. VMware虚拟机中的CentOS7安装Nginx后本机无法访问的解决办法

    VMware虚拟机中的CentOS7安装Nginx后本机无法访问的解决办法 在linux上安装nginx 请参考:Linux Centos7 安装 nginx 在虚拟机centos7上安装nginx之 ...

  5. Centos7 下nginx nginx-1.13.4 安装

    环境:CentOS Linux release 7.3.1611 (Core)  Linux localhost.localdomain 3.10.0-514.26.2.el7.x86_64 #1 S ...

  6. centos7安装nginx的两种方法

    第一种方式:通过yum安装 直接通过 yum install nginx 肯定是不行的,因为yum没有nginx,所以首先把 nginx 的源加入 yum 中 运行下面的命令: 1.将nginx放到y ...

  7. CentOS7 安装Nginx+MySQL

    首先我们需要安装nginx的yum源 [root@AD ~]# rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-releas ...

  8. (转)AIX7.1安装Nginx 1.13的方法

    原文:https://blog.csdn.net/lvshaorong/article/details/79401860 https://blog.csdn.net/lvshaorong/articl ...

  9. Centos7安装Nginx实战

    一.背景 最近在写一些自己的项目,用到了nginx,所以自己动手来在Centos7上安装nginx,以下是安装步骤. 二.基本概念以及应用场景 1.什么是nginx Nginx是一款使用C语言开发的高 ...

随机推荐

  1. 分布式监控系统开发【day38】:报警模块解析(六)

    一.负责把达到报警条件的trigger进行分析 ,并根据 action 表中的配置来进行报警 1.目录结构 2.功能如下 1.找到trigger的关联动作, 2.收到的数据传给trigger_msg就 ...

  2. Spring的事务机制

    ---恢复内容开始--- 内定的=>(只需要在xml 中添加一个bean) 在xml 中添加 <bean id="listener" class="com.t ...

  3. Linux的vim编辑器中的翻页命令

    当我们进入Linux的vim编辑器查看脚本时,按上下键查看是不是非常慢?这个时候就要用到我们的翻页快捷键了,快捷键命令如: 整页翻页命令为:Ctrl + f 键   f 的英文全拼为:forward: ...

  4. [mysql]错误解决之"Failed to start MySQL Server"

    最近又开始倒腾mysql了,遇到了一个以前没有见过的问题. 问题如下: 百度了好久,发现写的文章都千篇一律,解决办法也都几乎是一样的,然而在我这里一点儿用都没有. 所以FQ看了看外面的世界,终于找到了 ...

  5. codeforces 893F - Physical Education Lessons 动态开点线段树合并

    https://codeforces.com/contest/893/problem/F 题意: 给一个有根树, 多次查询,每次查询对于$x$i点的子树中,距离$x$小于等于$k$的所有点中权值最小的 ...

  6. python学习第24天

    内置方法 常用 __new__ __del__ __call__ 不常用 __str__ __repr__ __enter__ __exit__

  7. 转载一篇好理解的vue ssr文章

    转载:原文链接https://www.86886.wang/detail/5b8e6081f03d630ba8725892,谢谢作者的分享 前言 大多数Vue项目要支持SSR应该是为了SEO考虑,毕竟 ...

  8. JavaScript入门学习笔记(JSON)

    JSON是JavaScript Object Notation的简称,是一种轻量级的数据交换格式. JSON使用JS的语法,但其格式只是一个文本,可以被任何编程语言读取病作为数据格式传递. JSON以 ...

  9. svn忽略不需要同步的文件夹或文件

    如果某个文件已经提交到了svn,这个时候需要通过svn来把服务器上的改文件删除,然后再在本地,点击该文件 选择把该文件删除,recursively表示递归删除(文件下->下级文件夹->下级 ...

  10. VIM编辑常用命令

    1.临时使用获取root权限保存文件 :w !sudo tee % 2.多标签编辑文件 :tabnew file 3.切换标签 :tabm N   (N为第几个标签,从0开始)