[英]How to set permissions for files in xampp htdocs folder?
I created a website using xampp local host and the database information is stored in htdocs/config.cfg. 我使用xampp本地主机创建了一个网站,数据库信息存储在htdocs / config.cfg中。 If I type in 192.168.0.100/config.cfg the browser display the sql database security information.
如果我输入192.168.0.100/config.cfg,浏览器将显示sql数据库安全信息。 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.
任何人都可以帮助我如何解决此问题以及客户端如何通过不编辑driver / etc / hosts文件来以domain.com而不是192.168.0.100的身份访问我的网站。
Use virtualhosts https://delanomaloney.com/2013/07/10/how-to-set-up-virtual-hosts-using-xampp/ 使用虚拟主机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 . 如果使用php,请对所有文件使用.php文件扩展名blahblah.inc和blahblah.cfg 。 Right way is: blahblah.cfg.php
正确的方法是: blahblah.cfg.php
If you need .cfg and inc extension, configure vhost or apache httpd.conf: 如果需要.cfg和inc扩展名,请配置vhost或apache httpd.conf:
AddType application/x-httpd-php .inc
AddType应用程序/ x-httpd-php .inc
AddType application/x-httpd-php .cfg
AddType应用程序/ x-httpd-php .cfg
(you need check your server/hosting and configuring it too if you upload your code) (如果您上传代码,则还需要检查服务器/主机并对其进行配置)
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. 您需要在路由器的配置中为计算机设置端口转发,以使Web服务器可从局域网外部访问。 Here's a little step-by-step tutorial:
以下是一些分步教程:
Now, everyone should be able to access your web server using your public IP adress . 现在,每个人都应该可以使用您的公共IP地址访问您的Web服务器。
The access to your config.cfg can simply be restricted by using .htaccess file or by creating a new virtualhosts. 可以仅通过使用.htaccess文件或通过创建新的虚拟主机来限制对config.cfg的访问。 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! 请注意,XAMPP不适用于生产服务器!
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. 出于性能和安全性的考虑 ,我强烈建议将Apache或nginx与最新的PHP 7.0.x和MySQL一起使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.