How can I configure main VPS IP?

February 14, 2017 1.1k views
Apache Ubuntu 16.04

I have some domains installed on my VPS, they work perfect when I visit their domain names, but the problem is I see one of them when visiting with VPS IP address. How can I configure to see the stuff I want when visiting VPS IP address?

1 comment
  • Are you looking for experties to help grow your
    business or company!

    https://www.mainvps.net/

    We are a great Hosting service provider, customer satisfaction is the ultimate requirement for us.
    What to look for when choosing a dedicated server for hosting
    Most people would like to opt for server sharing but just for the serious online guys, this is what you would want to look for in dedicated server for hosting.

    DedicatedHosting #Hosting #DedicatedServer webhost #web #Website #onlinebusiness #internet #digital #online #hosting #sharedhosting #responsive

    https://www.mainvps.net

2 Answers

@narektigranyan

Apache handles things in a slightly odd manor when it comes to the default site that is shown when a domain is not specified.

Apache handles the configuration files in alphabetical order as they appear, so if you have:

/etc/apache2/sites-available/site01.com
/etc/apache2/sites-available/site02.com
/etc/apache2/sites-available/site03.com

Then /etc/apache2/sites-available/site01.com is going to be the default server that is shown when nothing else matches the request being handled.

To work around this, you'd create a new VirtualHost block and place it inside of a new configuration file that's prefixed with a number. For example:

/etc/apache2/sites-available/000-default.conf

You can set 000-default.conf to point to a separate directory and handle the request as you'd like, display a message within a simple index.html file, etc.

To create the symlink you'd then run:

a2ensite 000-default.conf
Have another answer? Share your knowledge.