Meteor.js和Apache / Nginx的同一台服务器上提供不同的域名 [英] Meteor.js and Apache/Nginx on the same server serving different domain names
问题描述
如何配置一台服务器来服务 http://domain1.com 使用Meteor.js和的使用nginx的/阿帕奇http://domain2.com ?
How can we configure a server to serve http://domain1.com using Meteor.js and http://domain2.com using nginx/apache?
推荐答案
另外其他的方式做到这一点是让nginx的处理代理和使用虚拟主机的流量分离。
Another other way to do this is let nginx handle the proxying and using virtual hosts to separate the traffic.
您需要的nginx 1.4.3或更高版本代理的WebSockets,而下面的配置将做到这一点:
You'll need nginx 1.4.3 or newer to proxy websockets, and the following config will do it:
/etc/nginx/conf.d/upgrade.conf
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
的/ etc / nginx的/启用站点-/流星
server {
server_name domain1.com;
# add_header X-Powered-By Meteor;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
和为Apache网站上的nginx的配置是一样平常,但 SERVER_NAME domain2.com;
或任何你想将它命名
and your nginx config for the Apache site would be the same as usual, but with server_name domain2.com;
or whatever you want to name it.
这篇关于Meteor.js和Apache / Nginx的同一台服务器上提供不同的域名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!