3f1c49ca2c9032e5a01a72dcdcc9aa282b5e71b5
By:
maxgonpe

Two domains into one ip, what can i do ?

April 26, 2017 199 views
DigitalOcean Ubuntu 16.04

Someone knows how to do to address two different domains to a single ip. I was trying on the panel, but I got confused a bit and I did not succeed, I only managed to access a single domain.

What I want is that "mydomain.cl" and "maydomain.com" come to my same application.

Well I hope some clue. Thank you

3 Answers
benrebia April 26, 2017
Accepted Answer

ENTER OTHER DNS TO YOUR NEW DOMAIN AND SEE BLOCKSERVER NGINX
EASY TAKE 5 MINUTE

by Justin Ellingwood
Nginx is an incredibly powerful web server and reverse proxy. In this guide, we'll discuss how to set up server blocks on Ubuntu 14.04 in order to server multiple domains from a single server.

@benrebia

Thanks, you're right, I'll do the tutorial steps, as you suggest. And I'll let you know the result.

@benrebia

<<<<Domains and ip number replace them with "xxxx" and "999" for obvious reasons of privacy and security in this publication>>>

Hi, I really need help with this. I did according to the steps of the tutorial but with some changes, because my site is already working well on the web and I do not want it to fall.

I explain: I have a domain www.xxxxxx.cl which is working super well, all this works for me in / home / max / myproject

/ etc / nginx / sites-available / myproject

Contains:
Server {
     Listen 80;
     Servername 99.999.999.99 xxx.cl www.xxx.cl;
     500M client
maxbodysize;
     Location = /favicon.ico {accesslog off; Lognot_found off; }
     Location / static / {
         Root / home / max / myproject;
     }

     Location / {
         Include proxyparams;
         Proxy
pass http: // unix: /home/max/myproject/myproject.sock;
     }
}

And my other file

/ etc / nginx / sites-available / myproject2

server {
listen 80;
servername 99.999.999.99 xxx.com www.xxx.com;
client
maxbodysize 500M;
location = /favicon.ico { accesslog off; lognot_found off; }
location /static/ {
root /home/max/myproject;
}

location / {
    include proxy_params;
    proxy_pass http://unix:/home/max/myproject/myproject.sock;
}

}

****************** My settings.py file ****************

ALLOWED_HOSTS = ['xxx.cl', 'www.xxx.cl',' xxx.com', 'www.xxx.com' , 'ip number']


I enter with my domain.cl and everything works perfect

but When I enter with my domain.com, Then the browser sends me the following message "This site can’t be reached"

*****************/etc/systemd/system/gunicorn.service **************************
[Unit]
Description=gunicorn daemon
After=network.target

[Service]
User=max
Group=max
WorkingDirectory=/home/max/myproject/myproject
ExecStart=/home/max/myproject/myprojectenv/bin/gunicorn --workers 3 -u max -g max --bind unix:/$

[Install]
WantedBy=multi-user.target


Help me, what can be wrong?
Do not delay in answering, if positive or negative.

Have another answer? Share your knowledge.