Page 1 of 1
Recommended way to redirect server IP to Domain?[Self Solve]
Posted: Fri Oct 02, 2015 6:32 pm
by weirdaljr
Right now I run one site on Vesta and it has SSL on it. Currently by default when you go to
http://111.111.111.111 it shows the "default.domain - Powered by VESTA" default page for a new site. I just want the
http://111.111.111.111 to redirect to
http://domain.com or
https://domain.com as
http://domain.com already goes to
https://domain.com.
Which conf is best to put this in and what method?
Re: Recommended way to redirect server IP to Domain?
Posted: Mon Oct 05, 2015 8:47 pm
by weirdaljr
Has anyone been able to do this with Vesta?
Re: Recommended way to redirect server IP to Domain?
Posted: Tue Oct 06, 2015 1:04 am
by weirdaljr
With my 1 ip server I was able to figure out how to do it by editing the one nginx conf below. This worked for me on a 1 IP VPS running Ubuntu with default templates:
/etc/nginx/conf.d/[IP ADDRESS].conf
Code: Select all
server {
listen [IP ADDRESS]:80 default;
server_name _;
access_log /var/log/nginx/[IP ADDRESS].log main;
location / {
return 301 https://DOMAINNAME.com;
}
}
Re: Recommended way to redirect server IP to Domain?[Self Solve]
Posted: Thu Dec 06, 2018 2:54 pm
by thunder1
I know is way later,but I can confirm that is working on CentOS 7 too, same 1 IP, VPS.