How do you set the default website for maintenance when your IP address is entered as a URL?

I have a server with several websites hosted and recognized using name-based apache shared hosting.

How to set it up so that your website displays the IP address of my server in the address bar?

+7
apache ip
source share
2 answers

What you want to use is _default_ VirtualHost .

 <VirtualHost _default_:80> DocumentRoot /www/default80 # ... </VirtualHost> 

It is described here . Basically, if nothing else matches the request, the _default_ host will be used.

EDIT
This can also be written as:

 <VirtualHost *> DocumentRoot /www/default # ... </VirtualHost> 

It’s important that this is the first VirtualHost in the configuration, since Apache will start matching them from top to bottom, choosing the one that works best based on ServerName and ServerAlias .

This post may also be of interest: Default Virtualhost for Apache

+15
source share

just find the line Include sites-enabled/ in your apache2.conf file and add the path to the conf file that you want to use by default by default. from:

 Include sites-enabled/ 

to

 Include sites-enabled/mydefault.conf Include sites-enabled/ 
+3
source share

All Articles