Nginx反向代理简单配置
一、首先在IIS中部署两个站点,localhost:86 、localhost:5000
二、修改C:\windows\system32\drivers\etc\hosts文件,增加 127.0.0.1 test1.yubay.cn 、127.0.0.1 test2.yubay.cn 两个Ip 域名映射
三、修改Nginx配置文件nginx.conf,增加两个server节点
#user nobody;
worker_processes ; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections ;
} http {
include mime.types;
default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on;
#tcp_nopush on; #keepalive_timeout ;
keepalive_timeout ; #gzip on; server{
listen ;
server_name test1.yubay.cn; location / {
proxy_pass http://127.0.0.1:86;
index index.html index.htm;
}
} server{
listen ;
server_name test2.yubay.cn; location / {
proxy_pass http://127.0.0.1:5000;
index index.html index.htm;
}
} server {
listen ;
server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / {
root html;
index index.html index.htm;
} #error_page /.html; # redirect server error pages to the static page /50x.html
#
error_page /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
} # another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen ;
# listen somename:;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen ssl;
# server_name localhost; # ssl_certificate cert.pem;
# ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on; # location / {
# root html;
# index index.html index.htm;
# }
#} }
四、启动Nginx,start nginx
浏览器访问 http://test1.yubay.cn:81 、http://test2.yubay.cn:81 会跳转到我们部署在IIS上的实际站点


五、停止nginx ,nginx -s stop
Nginx反向代理简单配置的更多相关文章
- Nginx反向代理的配置
Chapter: Nginx基本操作释疑 1. Nginx的端口修改问题 2. Nginx 301重定向的配置 3. Windows下配置Nginx使之支持PHP 4. Linux下配置Nginx使之 ...
- nginx反向代理的配置优化
作者:守住每一天 blog:liuyu.blog.51cto.combbs:bbs.linuxtone.orgmsn:liuyubj520#hotmail.comemail:liuyu105#gmai ...
- Centos7 nginx 反向代理的配置
一.正向代理与反向代理 1.正向代理 正向代理往VPN理解 正向代理,也就是传说中的代理,他的工作原理就像一个跳板(VPN),简单的说: 我是一个用户,我访问不了某网站,但是我能访问一个代理服务器,这 ...
- 【netcore基础】CentOS 7.6.1810 搭建.net core 2.1 linux 运行环境 nginx反向代理 supervisor配置自启动
之前写过一篇Ubuntu的环境搭建博客,感觉一些配置大同小异,这里重点记录下 nginx 作为静态 angular 项目文件服务器的配置 参考链接 [netcore基础]ubuntu 16.04 搭建 ...
- [svc]tomcat目录结构/虚拟主机/nginx反向代理cache配置
tomcat目录文件 /usr/local/tomcat/bin/catalina.sh stop sleep 3 /usr/local/tomcat/bin/catalina.sh start to ...
- Nginx反向代理搭建配置
1.反向代理方式是指以代理服务器来接受internet上的连接请求,然后将请求转发给内部网络上的服务器,并将服务器上得到的结果返回给internet 上请求连接的客户端,此时代理服务器对外就表现为一个 ...
- Tomcat多个项目部署,通过Nginx反向代理分别配置二级域名的流程
购买域名.示例:example.com 设置多个二级域名.如图: 配置tomcat文件: 修改tomcat/conf目录下的server.xml文件: 如下配置配置了3个容器,使用三个不同的端口. 请 ...
- Nginx反向代理websocket配置实例
最近有一个需求,就是需要使用 nginx 反向代理 websocket,经过查找一番资料,目前已经测试通过,本文只做一个记录 复制代码 代码如下: 注: 看官方文档说 Nginx 在 1.3 以后的版 ...
- 服务器上nginx反向代理的配置
Nginx不但是一款高性能的Web服务器,也是高性能的反向代理服务器.下面简单说说Nginx的反向代理功能. 反向代理是什么? 反向代理指以代理服务器来接受Internet上的连接请求,然后将请求转发 ...
随机推荐
- jQuery和原生JS的对比
原生JS的缺点: 不能添加多个入口函数(window.onload),如果添加了多个,后面的会把前面的覆盖掉 原生js的api名字太长,难以书写,不易记住 原生js有的代码冗余 原生js中的属性或者方 ...
- C# 使用多线程,在关闭窗体时 怎么关闭窗体的所有线程,使程序退出。
this.Close(); 只是关闭当前窗口,若不是主窗体的话,是无法退出程序的,另外若有托管线程(非主线程),也无法干净地退出: Application.Exit(); 强制所有消息中止,退出 ...
- Linux下的电路设计辅助软件
造冰箱的大熊猫@cnblogs 2019/8/21 最近调研了以下开源的电路设计辅助软件(EDA),汇总如下 1.gEDA 官网:geda-project.org 老牌的开源EDA软件,诞生于上世纪9 ...
- P1558 色板游戏 状压线段树
P1558 色板游戏 状压线段树 题面 洛谷P1558 每次不同颜色覆盖一段区间,每次询问一段区间有多少种颜色 因为颜色数\(T\)很小,使用二进制表示状态当前区间有那些颜色,二进制第\(i\)位表示 ...
- idea快捷方式1
Ctrl+Alt+O 优化导入的类和包 Alt+Insert 生成代码(如get,set方法,构造函数等) 或者右键(Generate) fori/sout/psvm + Tab Ctrl+Alt ...
- qt5 + vs2015自定义控件错误:undefend interface
控件中编译时因为是把所有的单个控件集成到一个lib中,所以会引用#include<QDesignerCustomWidgetInterface>以及#include<QDesigne ...
- php使用ZipArchive提示Fatal error: Class ZipArchive not found in的解决方法
使用压缩包函数必须要安装zip扩展,否则会报错 $ apt install php-zip
- IntelliJ IDEA 设置忽略SVN文件和文件夹
IntelliJ IDEA 在提交文件至SVN时,可以设置忽略某些文件和文件夹,以免误提交不需要提交的文件.最后,插个题外话,介绍一下如何设置代码默认折叠或者展开.下面使用IntelliJ ID ...
- RAFT选举算法-分布式数据库困惑
在做HIS研发工作的时候一直想完善其数据组件,想做一个分布式的数据库支持系统.但一直以来都不清楚这个选举算法应怎么做,原来有一个叫raft的算法https://www.cnblogs.com/just ...
- PG数据库创建并执行存储过程批量插入数据
记录一下PG数据库创建并执行存储过程批量插入数据的SQL: create or replace function addId() returns boolean AS $BODY$ declare i ...