Ask A Question

Notifications

You’re not receiving notifications from this thread.

host multiple websites with one ip

sreena asked in Servers

i am trying to host ruby on rails website in linode(deploying via puma and nginx capistrano). i am having a single(ip) server, where i have to host 3 e-commerce websites. i tried to host but all three websites points to same domain. please help me to rectify the problem.
Here is my nginx config of 1st website.
vi jobsenlist.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;
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;
}

my 2nd website configuration
vi www.obssupport.in

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 obssupport.in www.obssupport.in;
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;
}

my 3rd website configuration
vi flexijobsin.com

upstream atm-availability-tariff-meter-puma {
server unix:///home/root/apps/atm-availability-tariff-meter/shared/tmp/sockets/atm-availability-tariff-meter-puma.sock;
}
server {
listen 80;
listen [::]:80;
root /home/root/apps/atm-availability-tariff-meter/current/public;
index index.html index.htm index.nginx-debian.html;
server_name flexijobsin.com www.flexijobsin.com;
access_log /home/root/apps/atm-availability-tariff-meter/current/log/nginx.access.log;
error_log /home/root/apps/atm-availability-tariff-meter/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;
}

What is wrong with my configuration. when i type jobsenlist.com or flexijobsin.com or www.obssupport.com all points to same domain , why it is happening so. please help

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,464+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.