【发布时间】:2014-05-17 05:50:16
【问题描述】:
我有四台 Windows PC 无线连接到本地网络,我想在服务器上托管我的 PHP 网站,以便所有连接到服务器的 PC 都可以通过 IP 地址访问 Web 应用程序。
【问题讨论】:
标签: apache networking intranet localserver
我有四台 Windows PC 无线连接到本地网络,我想在服务器上托管我的 PHP 网站,以便所有连接到服务器的 PC 都可以通过 IP 地址访问 Web 应用程序。
【问题讨论】:
标签: apache networking intranet localserver
首先使用路由器连接网络中的PC。
这是图表
_____________
| Router | Router IP 10.0.0.2
| |
-------------
; ; ; ;
; ; ; ;
; ; ; ;
; ; ; ;
; ; ; ;
; ; ; ;
; ; ; ;
_____________ _____________ ______________ ___________
| PC 1 | | PC 2 | | PC 3 | | PC 4 |
| | | | | | | |
------------- ------------- -------------- -----------
IP 10.0.0.2 IP 10.0.0.3 IP 10.0.0.4 IP 10.0.0.5
Server PC Client PC Client PC Client PC
This IP should
always be
static
以下步骤
服务器电脑到路由器的连接始终使用以太网连接
获取服务器PC的MAC地址
在路由器中
登录服务器
进入 LAN 设置菜单添加静态 IP 10.0.0.2 和服务器 MAC 地址
转到端口转发菜单并将端口 80 和 8080 转发到 IP 10.0.0.2
在服务器 PC 中
为 PHP 主机安装 apache 服务器
转到httpd.conf文件并找到代码
AllowOverride All
#
# Controls who can get stuff from this server.
#
# Require all granted
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
Allow from localhost
在下面的“Allow from localhost”之后添加这段代码
Allow from 10.0.0.2
Allow from 10.0.0.3
Allow from 10.0.0.4
Allow from 10.0.0.5
可以增加客户端PC并将IP添加到服务器httpd.conf文件中
现在是庆祝的时候了
【讨论】:
在本地网络或外部服务器上托管您的服务器没有太大区别,这都归结为以下一般步骤:
安装您的网络服务器,例如Apache 并确保它的 php 扩展处于活动状态(默认)
确保您的网络服务器绑定到正确的 IP(例如,可以从网络外部访问的 192.168.1.xx 或 0.0.0.0)
确保防火墙(服务器和客户端)允许通信(IP 和端口)
【讨论】: