Page 1 of 1

Default Web Sites

Posted: Sun Nov 03, 2013 7:45 pm
by Graham
Two quick questions that somebody might be able to help with.

1) How do I specify which website is the default for a server?

E.g. how do I set which website appears if someone just browses to the IP address of the server?

2) I'd like to restrict access to the Vesta Control Panel to a specific domain rather than to all websites on the server.

E.g. at the moment I can append port 8083 to any https IP address or website hosted on a particular server and I'm presented with the Vesta login. I'd like to restrict that so it's only available through a specific subdomain.

Re: Default Web Sites

Posted: Mon Nov 04, 2013 5:08 am
by KeiroD
Graham wrote:Two quick questions that somebody might be able to help with.

1) How do I specify which website is the default for a server?

E.g. how do I set which website appears if someone just browses to the IP address of the server?

2) I'd like to restrict access to the Vesta Control Panel to a specific domain rather than to all websites on the server.

E.g. at the moment I can append port 8083 to any https IP address or website hosted on a particular server and I'm presented with the Vesta login. I'd like to restrict that so it's only available through a specific subdomain.
Why? cPanel doesn't restrict it to the subdomain only when you attempt logging into the control panel.

Re: Default Web Sites

Posted: Mon Nov 04, 2013 7:06 am
by Graham
KeiroD wrote:Why? cPanel doesn't restrict it to the subdomain only when you attempt logging into the control panel.
I think I sorted item 1 in the assigned domain setting for the IP address.

Item 2 because I would limit to limit the number of ways into the control panel if possible. It's not a showstopper for me, more of a nice to have. The fact that I can ask this kind of question is one (of the many) reasons I quickly ruled out cpanel for my requirements.

Re: Default Web Sites

Posted: Mon Nov 04, 2013 9:40 am
by skid
1) There is no direct way to manage default domain. Of course if ip address is assigned to a specific user then only his domain will be shown. From a technical perspective all is simple. Apache and nginx reads configuration line by line and the first domain is set domain as default. You can change the order without any harm by editing file /etc/httpd/conf.d/vesta.conf

2) If you are familiar with nginx configuration you can modify /usr/local/vesta/nginx/conf/nginx.conf which is used for internal vesta webserver. Under vhost confuguration and before ssl directives insert following condition

Code: Select all

        if ($http_host != your-domaint.vestacp.com) {
            rewrite  (.*)  https://your-domain.vestacp.com$1;
        }
Then restart vesta

Code: Select all

service vesta restart

Re: Default Web Sites

Posted: Mon Nov 04, 2013 10:16 am
by Graham
skid wrote:1) There is no direct way to manage default domain. Of course if ip address is assigned to a specific user then only his domain will be shown. From a technical perspective all is simple. Apache and nginx reads configuration line by line and the first domain is set domain as default. You can change the order without any harm by editing file /etc/httpd/conf.d/vesta.conf

2) If you are familiar with nginx configuration you can modify /usr/local/vesta/nginx/conf/nginx.conf which is used for internal vesta webserver. Under vhost confuguration and before ssl directives insert following condition

Code: Select all

        if ($http_host != your-domaint.vestacp.com) {
            rewrite  (.*)  https://your-domain.vestacp.com$1;
        }
Then restart vesta

Code: Select all

service vesta restart
Thanks skid.

For number 1 I assigned a domain to the IP address but left the IP address itself as a shared IP. That appears to have changed the default website but left the other domains sharing that IP address untouched. Do you think that's likely to cause other problems (the box only has the one IP)?

I'll give your suggestions for my 2nd request a try later this morning.

Re: Default Web Sites

Posted: Mon Nov 04, 2013 10:21 am
by skid
No problem with shared ip as well.

Re: Default Web Sites

Posted: Mon Nov 04, 2013 12:35 pm
by KeiroD
Graham wrote:
KeiroD wrote:Why? cPanel doesn't restrict it to the subdomain only when you attempt logging into the control panel.
I think I sorted item 1 in the assigned domain setting for the IP address.

Item 2 because I would limit to limit the number of ways into the control panel if possible. It's not a showstopper for me, more of a nice to have. The fact that I can ask this kind of question is one (of the many) reasons I quickly ruled out cpanel for my requirements.
Ah, understandable.

Skid: Thanks for the how-to, as well. I'll add this to my wiki... heh. I seem to be collecting the things you can do to VestaCP there.

There's a thought.. but I'll have to look into it later.

Re: Default Web Sites

Posted: Sat Jun 20, 2015 10:47 am
by Darkace
hey i tried 2 but if i do that i only get to a site that is on my server.

panle.monaxe.nl

but normally i have to go tho the control panel if i put that domain name on my browser
can please someone help me
thanks in advance

Re: Default Web Sites

Posted: Thu Feb 25, 2016 6:16 pm
by baijianpeng
Graham wrote:...
1) How do I specify which website is the default for a server?

E.g. how do I set which website appears if someone just browses to the IP address of the server?
When I access my server with IP address, like:

http://122.114.108.184/

The webpage will be loaded from /var/www/html .

How can I change this? How can I use IP address to show web pages from one of those public_html folders in /home/username/web/domain.com/ folder?