我需要使用nginx-passenger在同一台服务器上部署多个捆绑的流星应用程序。我按照了phusion乘客指南,所有工作都很顺利。没有文档可以找到如何配置nxinx-passenger(我的意思是/ etc / nginx / sites -available中的appX.mydomain.conf)来运行多个应用程序。我需要以app1.mydomain.com,app2.mydomain.com等形式发布应用程序。有人可以帮我理解怎么做? 提前谢谢!
编辑:我的原始配置文件
server {
listen 80;
server_name app1.mydomain.com;
# Tell Nginx and Passenger where your app's 'public' directory is
root /path/toApp1/bundle/public;
# Turn on Passenger
passenger_enabled on;
# Tell Passenger that your app is a Meteor app
passenger_app_type node;
passenger_startup_file main.js;
# Tell your app where MongoDB is
passenger_env_var MONGO_URL mongodb://localhost:27017/myapp1db;
# Tell your app what its root URL is
passenger_env_var ROOT_URL app1.mydomain.com;
}
编辑:我建议的第二个流星实例的配置文件
server {
listen 80;
server_name app2.mydomain.com;
# Tell Nginx and Passenger where your app's 'public' directory is
root /path/toApp2/bundle/public;
# Turn on Passenger
passenger_enabled on;
# Tell Passenger that your app is a Meteor app
passenger_app_type node;
passenger_startup_file main.js;
# Tell your app where MongoDB is
passenger_env_var MONGO_URL mongodb://localhost:27017/myapp2db;
# Tell your app what its root URL is
passenger_env_var ROOT_URL app2.mydomain.com;
}
答案 0 :(得分:0)
中的每个Meteor实例都需要一个文件
/etc/nginx/sites-available
您需要将这些文件sym链接到
/etc/nginx/sites-enabled
除了方便之外,文件的名称并不重要,假设您有域app1.mydomain.com,因此该文件名为app1
将此另存为
/etc/nginx/sites-available/app1
并发出以下命令:
cd /etc/nginx/sites-enabled
ln -s ../sites-available/app1
您只需要弄清楚每个服务器将运行的端口,并设置nginx文件的内容(我假设您已经为第一个执行了)