在具有多个域的单个ip中托管多个网站

时间:2019-07-29 06:55:33

标签: ruby-on-rails-5 web-hosting linode

我正在尝试在linode的Rails网站上托管ruby(通过puma和nginx进行部署)。我有一个单一的(ip)服务器,在这里我必须托管3个电子商务网站。我尝试托管,但所有三个网站都指向同一个域。请帮助我解决问题。

这是我第一个网站的nginx配置。

vi jobsenlist.com

onTap

我的第二个网站配置

vi www.obssupportin.com

upstream puma {
  server unix:///home/root/apps/flexijobs-dev-review/shared/tmp/sockets/flexijobs-dev-review-puma.sock;
}
server {
    listen 80 default_server;
    listen [::]:80;
    #listen [::]:80 default_server;
    server_name jobsenlist.com;
    root /home/root/apps/flexijobs-dev-review/current/public;
    # Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
    return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
        listen [::]:443 ssl http2;
   ssl    on;
  ssl_certificate /etc/nginx/bundle.crt;
   ssl_certificate_key /etc/nginx/sites-available/private.key;
   server_name jobsenlist.com;
  root /home/root/apps/flexijobs-dev-review/current/public;
  access_log /home/root/apps/flexijobs-dev-review/current/log/nginx.access.log;
  error_log /home/root/apps/flexijobs-dev-review/current/log/nginx.error.log info;

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }

  try_files $uri/index.html $uri @puma;
  location @puma {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    proxy_pass http://puma;
  }

  error_page 500 502 503 504 /500.html;
  client_max_body_size 10M;
  keepalive_timeout 120;
}

我的第三个网站配置 vi flexijobsin.com

upstream obs-ticketing-system-puma {
  server unix:///home/root/apps/obs-ticketing-system/shared/tmp/sockets/obs-ticketing-system-puma.sock;
}
server {
  listen 80;

        root /home/root/apps/obs-ticketing-system/current/public;
        index index.html index.htm index.nginx-debian.html;

        server_name obssupportin.com www.obssupportin.com;

        access_log /home/root/apps/obs-ticketing-system/current/log/nginx.access.log;
  error_log /home/root/apps/obs-ticketing-system/current/log/nginx.error.log info;

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }

  try_files $uri/index.html $uri @puma;
  location @puma {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    proxy_pass http://puma;
  }

  error_page 500 502 503 504 /500.html;
  client_max_body_size 10M;
  keepalive_timeout 120;
}

我的配置出了什么问题。当我键入Jobenlist.com或flexijobsin.com或www.obssupport.com都指向同一个域时,为什么会这样。请帮助

0 个答案:

没有答案