-1

I hosted my several websites on Linode, they are all sharing a same IP address. I use webmin/virtualmin to manage my server and websites. Is it possible to visit one of the websites by IP address? Currently if I visit the IP, what shows in the browser is just an apache2 default page: http://45.79.146.98/. I think this also points to some folder on my server, but I don't know where it is.

P.S. If I can visit my websites by http://45.79.146.98/something, it is also acceptable. But I don't know where to start doing this.

shenkwen
  • 199

3 Answers3

2

Making my comment an answer thanks to docu provided by @marctxk

The first VHost in your apache config is the one showing when no FQDN is defined. Try placing the site you wish at the top of the others and that's the one being shown when just accessing by IP address.

Apache docs:

The asterisks match all addresses, so the main server serves no requests. Due to the fact that the virtual host with ServerName www.example.com is first in the configuration file, it has the highest priority and can be seen as the default or primary server. That means that if a request is received that does not match one of the specified ServerName directives, it will be served by this first

sysfiend
  • 1,417
0

In your virtual hosts configuration file, it should be possible to define the Servername as your ip address.

Example:

<VirtualHost 45.79.146.98:80>
ServerAdmin admin@example.com
ServerName 45.79.146.98
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

From the apache documentation

Syntax: ServerName [scheme://]domain-name|ip-address[:port]

-1

Opening that ip address in browser it tells that this file is located at /var/www/html/index.html

Edit. As OP owns server, then yes. You can modify that vhost and apache config too. I thinked that linode is doing virtual hosting. But it is doing virtual server hosting. So then op has full control of server. You must modify default config in /etc/apache2/sites-enabled directory.

In that configuration file change path from /var/www/html/ to your sites path.

Guntis
  • 683