Page 1 of 1

Close XAMPP access over a local network users.

PostPosted: 26. April 2018 02:27
by Spiker01
Hello. My English is poor. I hope you will understand me.

My OS GNU / Linux Mint.
Code: Select all
~ $ uname -a
Linux SpSystem 4.10.0-38-generic # 42 ~ 16.04.1-Ubuntu SMP Tue Oct 10 16:32:20 UTC 2017 x86_64 x86_64 x86_64 GNU / Linux).


Installed XAMPP for Ubuntu (xampp-linux-x64-7.2.4-0-installer.run). Everything works fine, but Server Apache and XAMPP resources are available from the local network. This is not acceptable for me, because in the local network of my apartment is a lot of other people's devices, including those who are versed in IT. I do not want them to have access to resources deployed to XAMPP: I watched how I develop sites, the results of my work (privacy).

To ensure that the XAMPP resources are not visible from the local network, I have managed the httpd configuration file (/opt/lamp/etc/httpd.conf). Changed the parameters of <Directory />:

Code: Select all
#AllowOverride none
#Require all denied

Order deny, allow
Deny from all
Allow from 127.0.0.1
   
#AllowOverride All
#Order allow, deny
#Allow from 127.0.0.1
</ Directory>


This yielded the result: By the external local IP (For example: 192.168.0.110, permanent, local.) The XAMPP home page became unavailable. But by 127.0.0.1 (Internal IP) it is available, although localhost is also not available (Browser: Ferefox, Chromium). It's strange. I checked the hosts file (/ etc / hosts): The localhost 127.0.0.1 entry is available. PHP gives phpinfo. But PHPMyAdmin does not work. I understand because of the wrong host. Therefore, I replaced the host in /opt/lampp/phpmyadin/config.inc.php from localhost to 127.0.0.1 (Crutch, Laughter). And of course PhpMyAdmin worked, it worked well when restarting XAMPP, but before rebooting the OS. After the OS was rebooted, it stopped working and gave: mysqli_real_connect (): (HY000 / 2002) (Two errors) and asked to check the host name. Editing /opt/lampp/phpmyadin/config.inc.php (localhost to 127.0.0.1 and back) no longer helped.

In addition, I noticed that the Chromium XAMPP statr page is only available on 127.0.0.1, and localhost is not available, in Firefox XAMPP start page is available both on localhost (Cntrl + R reload page) and on 127.0.0.1. Very strange behavior.

Now I need to ensure that XAMPP resources become inaccessible in the "external" local network, and PhpMyAdmin has earned without "crutches" and mistakes.

Thank you for watching.

Re: Close XAMPP access over a local network users.

PostPosted: 26. April 2018 06:48
by Altrea
Why don't you simply change the IP-Adresses Apache and MariaDB is listening on?
If you would replace Listen *:80 in your Apache configuration file with Listen 127.0.0.1:80, Apache would only reply on requests from localhost.

Re: Close XAMPP access over a local network users.

PostPosted: 26. April 2018 07:56
by Spiker01
I used the Internet search and revised a lot of documentation, local access restriction configurations, not only in XAMPP server, but also in Apache, NGINX. But I did not find such a simple solution. Laugh. In IT conferences people did not know what to do. Some could not understand how the configuration of Apache affects the MySQL host, offered many different solutions, including non-standard ones, right up to installation of NGINX. But no one has proposed such a simple and logical answer. When I just wrote in the conference what to do. They answered: Ligisto. Laugh.

Thanks for the answer.

Re: Close XAMPP access over a local network users.

PostPosted: 26. April 2018 11:05
by Altrea
You are welcome :D