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. RSF 分布式 RPC 服务框架的分层设计

    RSF 是个什么东西? 一个高可用.高性能.轻量级的分布式服务框架.支持容灾.负载均衡.集群.一个典型的应用场景是,将同一个服务部署在多个Server上提供 request.response 消息通知 ...

  2. eclise开发设置

    eclipse在debug模式下鼠标移动到变量上不显示值的问题 在eclipse中调试时,鼠标移动到变量上不显示值,使用ctrl+shift+i,或者通过配置达到目的:  Window->Pre ...

  3. Golang 新手可能会踩的 50 个坑【转】

    译文:https://github.com/wuYin/blog/blob/master/50-shades-of-golang-traps-gotchas-mistakes.md 原文:50 Sha ...

  4. IDEA手动创建JFinal项目

    http://www.jfinal.com/share/674 https://www.oschina.net/question/265150_110300

  5. Swift GCD的使用1

    typealias Task = (cancel : Bool) -> () func delay(time : NSTimeInterval, task : () -> ()) -> ...

  6. .net core 2.x - 日志 - to elasiticsearch

    记录日志到elasticsearch(es),下面简写es,然后我们可以通过kibana可视化的观察日志信息以及统计分析等. 1.起源 年中旬时候,公司有个需求是需要分析用户的地址,需要先分词处理然后 ...

  7. phpstorm对laravel的一些使用技巧

    安装laravel插件,设置ctrl+alt+s 二 安装智能提示插件 composer require barryvdh/laravel-ide-helper 在config/app.php的pro ...

  8. Intervals 差分约束

    题意:给定n个区间[Li,Ri]以及n个整数vi. 现在要有一个集合,使得这个集合和任意[Li,Ri]都有 至少 vi个元素相同. 问这个集合最少要几个元素. 定义S(x) 表示[1,x]中选择的元素 ...

  9. [LeetCode] Most Common Word 最常见的单词

    Given a paragraph and a list of banned words, return the most frequent word that is not in the list ...

  10. mysql 插入百万条数据

    利用mysql内存表插入速度快的特点,先存储过程在内存表中生成数据,然后再从内存表插入普通表中 一.创建内存表 CREATE TABLE `vote_record_memory` ( `id` ) N ...