【Nginx】-NO.141.Nginx.1 -【Nginx】
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】的更多相关文章
- 【nginx网站性能优化篇(2)】反向代理实现Apache与Nginx的动静分离(LNMPA)
为什么要使用反向代理 具体请参考这篇博文:[Linux常识篇(1)]所谓的正向代理与反向代理 在虚拟机上配置反向代理的步骤 首先假设你已经假设好了LNMP架构了,这时我们还要安装Apache和php, ...
- 简单聊聊不可或缺的Nginx反向代理服务器--实现负载均衡【上篇】
今天又是新的一周,我养足了精神去对待新一周的工作,但是今天到公司发现还是有一点空闲时间的,所以就想与之前接触过的Nginx再交往得更深一点儿. 什么是Nginx: Nginx是一款高性能的http服务 ...
- Nginx安装及配置详解【转】
nginx概述 nginx是一款自由的.开源的.高性能的HTTP服务器和反向代理服务器:同时也是一个IMAP.POP3.SMTP代理服务器:nginx可以作为一个HTTP服务器进行网站的发布处理,另外 ...
- 【Nginx】面试官竟然问我Nginx如何生成缩略图,还好我看了这篇文章!!
写在前面 今天想写一篇使用Nginx如何生成缩略图的文章,想了半天题目也没想好,这个题目还是一名读者帮我起的.起因就是这位读者最近出去面试,面试官正好问了一个Nginx如何生成缩略图的问题.还别说,就 ...
- 【修改端口号】linux下修改apache,nginx服务端口号
一.linux下修改apache端口号 yum安装后,apache配置文件: /etc/httpd/conf/httpd.conf 找到apache目录下的 httpd.conf, 使用vi 打开,找 ...
- 【Asp.net Core】在 Linux 子系统中安装 nginx 并配置反向代理
上一篇鸟文中,老周已经介绍过在 Ubuntu 子系统中安装 dotnet-sdk 的方法,本文老周给大伙伴们说说安装 nginx 服务,并配置反向代理.同样,老周假设你从来没有用过 Linux,所以老 ...
- 【学习笔记】启动Nginx、查看nginx进程、查看nginx服务主进程的方式、Nginx服务可接受的信号、nginx帮助命令、Nginx平滑重启、Nginx服务器的升级
1.启动nginx的方式: cd /usr/local/nginx ls ./nginx -c nginx.conf 2.查看nginx的进程方式: [root@localhost nginx] ...
- 菜鸟入门【ASP.NET Core】3:准备CentOS和Nginx环境转(转)
基本软件 VMware虚拟机 centos:http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-170 ...
- 在分析nginx日志时常用命令总结【转】
1. 利用grep ,wc命令统计某个请求或字符串出现的次数 比如统计GET /app/kevinContent接口在某天的调用次数,则可以使用如下命令: [root@Fastdfs_storage_ ...
- LNMP(linux+nginx+mysql+php)服务器环境配置【转载】
本文转载自 园友David_Tang的博客,如有侵权请联系本人及时删除,原文地址: http://www.cnblogs.com/mchina/archive/2012/05/17/2507102.h ...
随机推荐
- Linux-CentOS 重置root密码
1. 重启服务器,在读秒的时候按任意键,就会出现如下界面 2.接着按下e就会进入到如下界面. 将光标移动到kernel那一行,然后再一次按‘e’,进入kernel该行的编辑界面 3.这就是kernel ...
- apache负载调优
Apache负载调优 watch -n 1 -d "pgrep httpd|wc -l" #apache动态查看连接数 ps aux | grep httpd | wc ...
- RabbitMQ 学习日记
RabbitMQ三种Exchange模式(fanout,direct,topic)的性能比较 http://www.rabbitmq.com/tutorials/tutorial-one-dotnet ...
- UOJ#172. 【WC2016】论战捆竹竿 字符串 KMP 动态规划 单调队列 背包
原文链接https://www.cnblogs.com/zhouzhendong/p/UOJ172.html 题解 首先,这个问题显然是个背包问题. 然后,可以证明:一个字符串的 border 长度可 ...
- UOJ#42. 【清华集训2014】Sum 类欧几里德算法
原文链接https://www.cnblogs.com/zhouzhendong/p/UOJ42.html 题解 首先我们把式子改写一下: $$(-1)^{\lfloor a\rfloor} \\=1 ...
- Maven中pom.xml文件的配置
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...
- ViewPager+Fragment实现滑动切换页面
1.实现思路 主界面四个导航按钮使用RadioButton,通过Selector 设置它的drawableTop属性来设置所显示的图片.通过 FragmentPagerAdapter 实现切换. 2. ...
- linux(ubuntu) 安装composer(PHP用来管理依赖关系的工具 ) 和安装中国全量镜像
https://www.phpcomposer.com/ composer中文网 1:进入安装目录 cd /usr/local/bin 2:下载并安装 sudo curl -s http ...
- [LeetCode] Shortest Distance to a Character 到字符的最短距离
Given a string S and a character C, return an array of integers representing the shortest distance f ...
- YARN的基础配置
基于HADOOP3.0+Centos7.0的yarn基础配置: 执行步骤:(1)配置集群yarn (2)启动.测试集群(3)在yarn上执行wordcount案例 一.配置yarn集群 1.配置yar ...