Reputation: 41
I created a website using xampp local host and the database information is stored in htdocs/config.cfg. If I type in 192.168.0.100/config.cfg the browser display the sql database security information. Can any one help me how to overcome this issue and how clients can access my site as domain.com instead of 192.168.0.100 not by editing drivers/etc/hosts file.
Upvotes: 2
Views: 16052
Reputation: 193
You need to set up port forwarding for your computer in your router's configuration to make your web server accessible from outside of your local area network. Here's a little step-by-step tutorial:
Now, everyone should be able to access your web server using your public IP adress.
The access to your config.cfg can simply be restricted by using .htaccess file or by creating a new virtualhosts. I would recommend the second option because you need to create a new virtualhosts for your domain anyway.
Please note that XAMPP is not designed to be used for a production server!
For performance and security reasons, I do strongly recommend to use Apache or nginx with the current stables of PHP 7.0.x and MySQL.
Upvotes: 1
Reputation: 96
Use virtualhosts https://delanomaloney.com/2013/07/10/how-to-set-up-virtual-hosts-using-xampp/
If you using php, use .php file ext for all files instead blahblah.inc and blahblah.cfg. Right way is: blahblah.cfg.php
If you need .cfg and inc extension, configure vhost or apache httpd.conf:
AddType application/x-httpd-php .inc
AddType application/x-httpd-php .cfg
(you need check your server/hosting and configuring it too if you upload your code)
Upvotes: 1