Express设置主机头
来源:互联网 发布:大淘客到底是什么软件 编辑:程序博客网 时间:2024/05/16 16:57
摘自 https://github.com/visionmedia/express/blob/master/examples/vhost/index.js
/** * Module dependencies. */var express = require('../..');/*edit /etc/hosts:127.0.0.1 foo.example.com127.0.0.1 bar.example.com127.0.0.1 example.com*/// Main server appvar main = express();main.use(express.logger('dev'));main.get('/', function(req, res){ res.send('Hello from main app!')});main.get('/:sub', function(req, res){ res.send('requested ' + req.params.sub);});// Redirect appvar redirect = express();redirect.all('*', function(req, res){ console.log(req.subdomains); res.redirect('http://example.com:3000/' + req.subdomains[0]);});// Vhost appvar app = express();app.use(express.vhost('*.example.com', redirect)) // Serves all subdomains via Redirect appapp.use(express.vhost('example.com', main)); // Serves top level domain via Main server app app.listen(3000);console.log('Express app started on port 3000');
- Express设置主机头
- nginx--主机头设置
- 本地进行主机头设置
- 设置iis主机头实现二级域名
- IIS设置多主机头解决方案(荐)
- 设置iis主机头实现二级域名
- 为nginx设置默认虚拟主机(空主机头,默认主机头)
- IIS主机头设置[长期不用,防止忘记]
- 服务器网站主机头设置及域名DNS解析
- 在本地机设置主机头的方法
- 泛域名或者子域名 主机头设置
- apache主机头设置-一台服务器支持…
- IIS&Apache虚拟主机设置(主机头,一服多站)
- 什么是主机头
- 什么是主机头
- Nginx 绑定主机头
- nginx空主机头
- apache主机头设置-一台服务器支持多个网站,多个域名 ... [复制链接]
- MetaSploit 命令行用法
- windows键位虚拟操作标识符
- ubuntu hadoop 下ssh 登陆不了 connect to host localhost port 22:Connection refused
- 友元函数和友元类
- php cli多进程
- Express设置主机头
- OSPF协议工作原理
- poj 3252(细心+组合数溢出+边界条件计算+算上数据本身)
- Stein算法求最大公约数
- 关于C++默认构造函数的定义和调用
- 【转】常见的正则表达式
- Ubuntu 12.04 安装Openfire
- poj 1850(以字符a开始长度为len的个数+数字本身)
- ACM竞赛