Style:Mac

Series:Java

Since:2018-09-10

End:2018-09-10

Total Hours:1

Degree Of Diffculty:5

Degree Of Mastery:5

Practical Level:5

Desired Goal:5

Archieve Goal:3

Gerneral Evaluation:3

Writer:kingdelee

Related Links:

http://www.cnblogs.com/kingdelee/

2.安装编译参数

实践1:

需求:

tomcat:8081

访问test1.lee.com,通过nginx访问到8081

启动tomcat

vim /etc/hosts

127.0.0.1 test1.lee.com
127.0.0.1 test2.lee.com
127.0.0.1 test3.lee.com

  

cd /etc/nginx/conf.d

vim test1.conf

server {
listen 80;
server_name localhost test1.lee.com; location / {
proxy_pass http://127.0.0.1:8081;
index index.html index.htm;
}
}

wget test1.lee.com,即可访问到tomcat

  

大坑:

代理的时候不能加_,否则无法转发过去,会

root@localhost test]# wget test1.lee.com
--2018-10-30 17:55:04-- http://test1.lee.com/
Resolving test1.lee.com (test1.lee.com)... 127.0.0.1
Connecting to test1.lee.com (test1.lee.com)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 400
2018-10-30 17:55:04 ERROR 400: (no description).

  

正确的打开方式:

upstream test1{
server 127.0.0.1:8081;
} server {
listen 80;
server_name localhost test1.lee.com; location / {
proxy_pass http://test1;
include proxy_params;
index index.html index.htm;
}
}

  

【Nginx】-NO.141.Nginx.1 -【Nginx】的更多相关文章

  1. 【nginx网站性能优化篇(2)】反向代理实现Apache与Nginx的动静分离(LNMPA)

    为什么要使用反向代理 具体请参考这篇博文:[Linux常识篇(1)]所谓的正向代理与反向代理 在虚拟机上配置反向代理的步骤 首先假设你已经假设好了LNMP架构了,这时我们还要安装Apache和php, ...

  2. 简单聊聊不可或缺的Nginx反向代理服务器--实现负载均衡【上篇】

    今天又是新的一周,我养足了精神去对待新一周的工作,但是今天到公司发现还是有一点空闲时间的,所以就想与之前接触过的Nginx再交往得更深一点儿. 什么是Nginx: Nginx是一款高性能的http服务 ...

  3. Nginx安装及配置详解【转】

    nginx概述 nginx是一款自由的.开源的.高性能的HTTP服务器和反向代理服务器:同时也是一个IMAP.POP3.SMTP代理服务器:nginx可以作为一个HTTP服务器进行网站的发布处理,另外 ...

  4. 【Nginx】面试官竟然问我Nginx如何生成缩略图,还好我看了这篇文章!!

    写在前面 今天想写一篇使用Nginx如何生成缩略图的文章,想了半天题目也没想好,这个题目还是一名读者帮我起的.起因就是这位读者最近出去面试,面试官正好问了一个Nginx如何生成缩略图的问题.还别说,就 ...

  5. 【修改端口号】linux下修改apache,nginx服务端口号

    一.linux下修改apache端口号 yum安装后,apache配置文件: /etc/httpd/conf/httpd.conf 找到apache目录下的 httpd.conf, 使用vi 打开,找 ...

  6. 【Asp.net Core】在 Linux 子系统中安装 nginx 并配置反向代理

    上一篇鸟文中,老周已经介绍过在 Ubuntu 子系统中安装 dotnet-sdk 的方法,本文老周给大伙伴们说说安装 nginx 服务,并配置反向代理.同样,老周假设你从来没有用过 Linux,所以老 ...

  7. 【学习笔记】启动Nginx、查看nginx进程、查看nginx服务主进程的方式、Nginx服务可接受的信号、nginx帮助命令、Nginx平滑重启、Nginx服务器的升级

     1.启动nginx的方式: cd /usr/local/nginx ls ./nginx -c nginx.conf 2.查看nginx的进程方式: [root@localhost nginx] ...

  8. 菜鸟入门【ASP.NET Core】3:准备CentOS和Nginx环境转(转)

    基本软件 VMware虚拟机 centos:http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-170 ...

  9. 在分析nginx日志时常用命令总结【转】

    1. 利用grep ,wc命令统计某个请求或字符串出现的次数 比如统计GET /app/kevinContent接口在某天的调用次数,则可以使用如下命令: [root@Fastdfs_storage_ ...

  10. LNMP(linux+nginx+mysql+php)服务器环境配置【转载】

    本文转载自 园友David_Tang的博客,如有侵权请联系本人及时删除,原文地址: http://www.cnblogs.com/mchina/archive/2012/05/17/2507102.h ...

随机推荐

  1. python---哈希算法实现

    # coding = utf-8 class Array: def __init__(self, size=32, init=None): self._size = size self._items ...

  2. Scala数组| 集合

    arrays :+ 5尾部   头部5 +: arrays TODO 声明不可变数组,不能删; 默认情况下,scala中集合的声明全都是不可变的 val arrays: Array[Int] = Ar ...

  3. Python 求点到直线的垂足

    Python 求点到直线的垂足 在已知一个点,和一条已知两个点的直线的情况下 运算公式参考链接:https://www.cnblogs.com/mazhenyu/p/3508735.html def ...

  4. Imcash科普:没有网络也可以转账比特币?你可能有些误解

    近日,据Bitcoinist消息,比特币解决方案开发商CoinKite联合创始人Rodolfo Novak和OpenBazaar联合创始人Sam Patterson在推特上宣布,两人不借助互联网和卫星 ...

  5. PSO:利用PSO算法优化二元函数,寻找最优个体适应度—Jason niu

    figure [x,y] = meshgrid(-5:0.1:5,-5:0.1:5); z = x.^2 + y.^2 - 10*cos(2*pi*x) - 10*cos(2*pi*y) + 20; ...

  6. C. Queen Codeforces Round #549 (Div. 2) (搜索)

    ---恢复内容开始--- You are given a rooted tree with vertices numerated from 11 to nn . A tree is a connect ...

  7. MySql思维导图

  8. Python matplotlib图片转化成矢量图并裁剪

    Python目前可以生成的图的格式是:eps, jpeg, jpg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff 在写论文时候我一般生成png ...

  9. [CQOI2015]网络吞吐量

    Description: 给你一个图,每个点可以被经过\(a_i\)次,求有多少个人可以走最短路到n点 Hint: \(n \le 500\) Solution: 极其水的一道题,就当做复习最短路板子 ...

  10. 版本管理_svn_检出_更新_提交_本机 MAC 地址_冲突

    版本管理 git svn [subversion] 实现集中式的版本控制工具软件 来源于最初的工程图纸. 需求: 备份还原 协同修改 权限控制 弊端:集中式(管理方便,但是如果中心服务器瘫痪,整个开发 ...