简体   繁体   English

无需更改主机文件即可在 PHP/APACHE 中访问我的 Web 应用程序

[英]Access my web applications in PHP/APACHE without change host files

I work with Apache that is installed in a Windows Server(Windows Server 2012 R2) , so i have my web applications in the htdocs folder (in the server ofc) if i want to access the applications via other computers connected to the server i have to change each host file in each pc...我使用安装在 Windows Server(Windows Server 2012 R2)中的 Apache,所以如果我想通过连接到服务器的其他计算机访问应用程序,我将我的 Web 应用程序放在 htdocs 文件夹(在 server ofc 中)更改每台电脑中的每个主机文件...

If you work with 2, 3 pc that is ok, however when you have at least 40 pc's it can be very tiring.如果您使用 2、3 台电脑也可以,但是当您至少拥有 40 台电脑时,它会非常累人。

That's way i'm asking this question.我就是这样问这个问题的。

I mean,it's possible to simply put the url in the browser and the computers connected to the server enter in my web application?我的意思是,可以简单地将 url 放在浏览器中,然后连接到服务器的计算机输入到我的 Web 应用程序中吗?

This isn't maybe the best solution, but here it is in file C:\\xampp\\apache\\conf\\extra\\httpd-xampp.conf这可能不是最好的解决方案,但它在文件C:\\xampp\\apache\\conf\\extra\\httpd-xampp.conf

Inside <IfModule alias_module> write following lines<IfModule alias_module>写入以下几行

Alias / "C:\xampp\htdocs"
<Directory "C:\xampp\htdocs">
    AllowOverride all
    Order deny,allow
    Require all granted
</Directory>

Later restart apache and try to access you applications with inside the same intranet network :后来重启apache,并试图访问你的应用程序具有相同的内部intranet network

computer-name/app-folder/

In general this isn't the best solution because you are exposing entire root folder htdocs , also I would suggest to you to move you application from htdocs and define application in httpd-vhosts.conf file.一般来说,这不是最好的解决方案,因为您暴露了整个根文件夹htdocs ,我还建议您将应用程序从htdocs移动并在httpd-vhosts.conf文件中定义应用程序。 You can create aliases for application outside htdocs folder which are defined in httpd-vhosts.conf您可以为httpd-vhosts.conf中定义的htdocs文件夹之外的应用程序创建别名

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM