Keeping XAMPP Off the LAN

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Keeping XAMPP Off the LAN

Postby ddow » 08. March 2013 16:07

Hi

I want to build a MySQL database for a work project & have downloaded XAMPP Portable Lite to work on on my work laptop. I read in the documentation that the MySQL daemon, phpmyadmin & some other services are accessible via the network. While I am using this to develop the database & PHP pages I dont want anyone on my LAN to be able to discover/access the webserver or pages. I want it to remain totally local to my laptop.

How can I set up XAMPP Portable so it doesnt not show up on my LAN?

Many thanks
ddow
 
Posts: 2
Joined: 08. March 2013 16:06
Operating System: Win Vista

Re: Keeping XAMPP Off the LAN

Postby JonB » 08. March 2013 16:54

Assuming YOU wish to able to still use the network -

The easiest two step fix might be to edit the \xampp\apache\conf\extra\httpd-xampp.conf

search for:
Code: Select all
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
   Order deny,allow
   Deny from all
   Allow from ::1 127.0.0.0/8 \
      fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \
      fe80::/10 169.254.0.0/16

   ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>

change this:

Code: Select all
Allow from ::1 127.0.0.0/8 \
      fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \
      fe80::/10 169.254.0.0/16


To this

Code: Select all
Allow from ::1 127.0.0.1


Save the file

And then run the XAMPP Security Wizard (found through the XAMPP Welcome Page). Use the .htaccess it creates and places in \xampp\htdocs\xampp, and copy it to any folders you wish to protect. Only the user & password created in that process will have access. Be sure to use the save text file option for PW.

Restart XAMPP and test.

This basically restricts access to XAMPP suite parts to the local machine (first part), and then provides the .htaccess code that will prevent browsing parts of the DocumentRoot -- anywhere you place that .htaccess file will now require a password (second part).

This may not be the simplest, but I think it will do the job, and is easily reversed.

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Keeping XAMPP Off the LAN

Postby ddow » 08. March 2013 17:36

I do want to continue to use the network for other purposes, but I wont be hosting anything on this computer once I get the MySQL & PHP built. I am doing my coding, testing, etc, on this laptop then when everything is going well I will be handing the php files & code for the MySQL db over to someone else for hosting on the right server. I just dont want my computer to start showing up as a server on the LAN.
ddow
 
Posts: 2
Joined: 08. March 2013 16:06
Operating System: Win Vista

Re: Keeping XAMPP Off the LAN

Postby hackattack142 » 11. March 2013 22:22

Hello,

The above solution will keep people from viewing the contents of your pages but will not keep MySQL and Apache from being visible on your network.

If you are doing all development/testing on just your local machine you can configure Apache and MySQL to listen only on your machine (via the localhost/127.0.0.1 interface).

For Apache, you could go to "/xampp/apache/conf/httpd.conf", go to the
Code: Select all
Listen 80
line and change it to
Code: Select all
Listen 127.0.0.1:80


For MySQL, you could go to "/xampp/mysql/bin/my.ini" and change
Code: Select all
# bind-address="127.0.0.1"
to
Code: Select all
bind-address="127.0.0.1"


You will need to restart both for the changes to take effect.
XAMPP Control Panel Developer
Latest CP: viewtopic.php?f=16&t=48932
hackattack142
 
Posts: 701
Joined: 20. May 2011 23:29
Operating System: Windows 7 Ultimate SP1 64-Bit


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 137 guests