Nginx服务于node.js中的2个幽灵博客

我正在尝试使用nginxconfiguration运行Amazon linux的Amazon EC2实例,以在node.js中提供两个不同的ghost博客。

我的理解是,networkingstream量击中了ec2实例的公共IP,nginx正在侦听端口80,nginx的configuration文件反向代理每个域到每个博客的index.js文件正在侦听的端口。

我永远使用生产环境中运行两个index.js文件,但是当我开始两个域(domain1.com&domain2.com)显示相同的内容。 这似乎是开始第二个index.js覆盖/redirect到单个幽灵博客的stream量。

也许有些configuration可能有帮助:

主文件夹

ls ~ domain2.com node domain1.com 

Config.js for domain1.com

 cat ~/domain1.com/config.js production: { url: 'http://www.domain1.com/', mail: {}, database: { client: 'sqlite3', connection: { filename: path.join(__dirname, '/content/data/ghost.db') }, debug: false }, server: { host: '127.0.0.1', port: '2368' } }, 

Config.js for domain2.com

 cat ~/domain2.com/config.js production: { url: 'http://domain2.com/', mail: {}, database: { client: 'sqlite3', connection: { filename: path.join(__dirname, '/content/data/ghost.db') }, debug: false }, server: { host: '127.0.0.1', port: '2369' } } 

主要的nginxconfiguration

 cat /etc/nginx/nginx.conf server { listen 80 default_server; listen [::]:80 default_server; server_name domain1.com *.domain1.com; root /var/www/html; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_pass http://127.0.0.1:2368; } 

nginx conf.d文件夹

 ls /etc/nginx/conf.d/ domain2.com.conf virtual.conf 

nginx domain2.comconfiguration

 cat /etc/nginx/conf.d/domain2.com.conf server { listen 80; listen [::]:80; server_name domain2.com *.domain2.com; root /var/www/html; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_pass http://127.0.0.1:2369; } } 

我如何开始幽灵博客

 cd ~/domain2.com/ NODE_ENV=production forever start index.js cd ~/domain1.com/ NODE_ENV=production forever start index.js 

对不起超长的第一篇文章。 感谢您提前的帮助。