D
D
Dmitry Vladimirovich Speaker2018-04-26 04:39:05
PHP
Dmitry Vladimirovich Speaker, 2018-04-26 04:39:05

How to block local users from accessing XAMPP(Linux)?

Greetings.

MyOS GNU/Linux Mint.

~ $ 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 accessible from the local network. This is not acceptable for me, since there are many devices of other people, including those who understand IT, in the local network of my apartment. I don't want them to have access to resources deployed on XAMPP: They watched how I develop sites, at the results of my work (privacy).

In order to prevent XAMPP resources from being visible from the local network, I edited the httpd configuration file ( /opt/lamp/etc/httpd.conf). Changed settings:

#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 gave the result: From external local IP( For example: 192.168.0.110 . Permanent, localhost. ) the XAMPP start page is no longer available. But on 127.0.0.1 (Internal IP) it is available, although it is also not available on localhost. (Browser: Firefox, Chromium). Weird. I checked the hosts file (/etc/hosts): There is a localhost 127.0.0.1 entry. PHP gives phpinfo. But PHPMyAdmin is not working. I understand because of the wrong host. So I changed 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 fine even with XAMPP restarts, but before the OS was rebooted. After rebooting the OS, it stopped working and began to give: 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) didn't help anymore.

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

Now I need XAMPP resources to become inaccessible in the "external" local network, and PhpMyAdmin to work without "crutches" and errors.

Thank you for attention.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Vladimirovich Speaker, 2018-04-26
@Spiker01

One of the Administrators of the official XAMPP support forum simply advised changing the listen parameter in /opt/lamp/etc/httpd.conf to 127.0.0.1:80. Which is essentially logical. Here is such a simple solution. Then the server will only listen to one internal IP and that's it.
And the Directory parameters can be set to standard.

D
Dmitry Tallmange, 2018-04-26
@p00h

Order deny,allow
Deny from all
Allow from 127.0.0.1

This construct made your host inaccessible from anywhere but itself. That is, you can access your sites and PHPMyAdmin only from this machine. And nowhere else.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question