IP access to website

Hello

Im running a Linode512 with a LAMP stack and two domains.

Im doing a project where i need to get some JSON data from a PHP script to an Arduino micro-controller. The Arduino does not support DNS so i have to access the php via the IP address of my linode. But when i try to access the ip the only thing i get is a "Restricted Area" popup in my browser.

Is there some way of pointing that IP to the root of the Linode or some other workaround?

Im new and currently learning, so please bare with me ;)

All help is much appreciated!

Each domain is set up like this:

/etc/apache2/sites-available/domain.one

ServerAdmin email@domainone.com

ServerName domainone.com

ServerAlias www.domainone.com

DocumentRoot /srv/www/domainone.com/public_html/

ErrorLog /srv/www/domainone.com/logs/error.log

CustomLog /srv/www/domainone.com/logs/access.log combined

/etc/apache2/sites-available/domaintwo.com

ServerAdmin email@domaintwo.com

ServerName domaintwo.com

ServerAlias www.domaintwo.com

DocumentRoot /srv/www/domaintwo.com/public_html/

ErrorLog /srv/www/domaintwo.com/logs/error.log

CustomLog /srv/www/domaintwo.com/logs/access.log combined

3 Replies

Apache will direct clients accessing the server via the IP address to the default site (the first one you see by running ls -l /etc/apache2/sites-enabled on Debian or Ubuntu). Take a look at that config file to see where clients are being directed. It may be that your web application is generating an error if accessed without a host name.

You could create a config file in /etc/apache2/sites-available called something like "000-default" to send the Arduino (and anyone else accessing the server by IP address) to a location containing the JSON data.

Thank you so much for your reply.

The IP was directing on a subdomain protected by password (.htpasswd) which of course coursed the "Restricted Area" popup.

So i can setup the "000-default" config file like i did with domainone.com and domaintwo.com and direct to a specific folder?

I believe i solved it.

/etc/apache2/sites-available/default was not enabled. It is know and i can point it to where i want.

Thank you so much for your help and have a nice day :)

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct