nginx反向代理本地 单台wed -使用域名代理
2024-10-19 12:37:24
环境: 本地外网ip:123.58.251.166 、配置index.html网页 [root@host---- conf.d]# cat /web/sing/index.html
<h1>www.test1.com</h1> 、配置conf.d目录下配置文件 [root@host---- conf.d]# pwd
/etc/nginx/conf.d
[root@host---- conf.d]# ls
test1.conf test2.conf test3.conf
[root@host---- conf.d]# cat test1.conf
server {
listen ;
server_name 127.0.0.1:;
location / {
root /web/sing/;
index index.html index.htm;
}
} [root@host---- conf.d]# cat test3.conf
upstream abc.com {
server 127.0.0.1: fail_timeout=20s;
#server 127.0.0.1: fail_timeout=20s; #ip_hash; 打开后就会访问到一台上 } server { listen ;
server_name oa.test.com;
location / {
#反向代理的地址
proxy_pass http://abc.com;
}
} 、配置hosts [root@host---- conf.d]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: localhost localhost.localdomain localhost6 localhost6.localdomain6
123.58.251.166 oa.test.com [root@host---- conf.d]# nginx -s reload 、开始访问 注意:要从百度访问必须注册备案域名 [root@host---- ~]# curl http://oa.test.com
<h1>www.test1.com</h1>
最新文章
- Mysql数据库的使用总结之Innodb简介
- Android再学习
- C语言新文法
- python---tuple元祖
- 什么是闭包(closure),为什么要用它?
- 关于echarts的疑问
- Cheatsheet: 2013 07.01 ~ 07.08
- 网络编程之TCP异步群聊:服务器端代码
- 每日一dp(2)——龟兔赛跑(hdu 2059)
- ASP.NET MVC IOC之Unity攻略
- 基于Web的IIS管理工具
- noip推荐系列:遥控车[字符串+高精+二分答案]
- hibernate关联对象的增删改查------查
- arc 097 E - Sorted and Sorted
- 英文文档帮查&;翻译计划
- HDU 4391 Paint The Wall(分块的区间维护)
- Ubuntu更新软件源出现GPG error
- webuploader在ie7下的flash模式的使用
- 使用git 将自己的本地文件git到github上面的完整过程
- 一款纯css3实现的动画按钮