环境:

本地外网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>

最新文章

  1. Mysql数据库的使用总结之Innodb简介
  2. Android再学习
  3. C语言新文法
  4. python---tuple元祖
  5. 什么是闭包(closure),为什么要用它?
  6. 关于echarts的疑问
  7. Cheatsheet: 2013 07.01 ~ 07.08
  8. 网络编程之TCP异步群聊:服务器端代码
  9. 每日一dp(2)——龟兔赛跑(hdu 2059)
  10. ASP.NET MVC IOC之Unity攻略
  11. 基于Web的IIS管理工具
  12. noip推荐系列:遥控车[字符串+高精+二分答案]
  13. hibernate关联对象的增删改查------查
  14. arc 097 E - Sorted and Sorted
  15. 英文文档帮查&amp;翻译计划
  16. HDU 4391 Paint The Wall(分块的区间维护)
  17. Ubuntu更新软件源出现GPG error
  18. webuploader在ie7下的flash模式的使用
  19. 使用git 将自己的本地文件git到github上面的完整过程
  20. 一款纯css3实现的动画按钮

热门文章

  1. 如何实现数组和 List 之间的转换?(未完成)
  2. openpose-opencv 的body数据多人体姿态估计
  3. ZZNUOJ-2154:单身狗线下聚会【求N个数的最小公倍数,会超longlong,大数乘法,Java】
  4. Selenium(十)测试用例错误处理、日志接口、多用户测试
  5. jQuery获取select元素选择器练习
  6. 为什么size_t重要?(Why size_t matters)
  7. 【深入学习Redis】Redis内存模型
  8. java上传文件夹
  9. C++ 2048游戏
  10. mac 安装oh-my-zsh的问题