配置Apache将自己的电脑做服务器使局域网内的电脑访问自己的主机

时间:2021-02-07 14:20:04

更改Apache的httpd-vhost.conf文件

原来的:

# Virtual Hosts

#

<VirtualHost *:80>

ServerName localhost

ServerAlias localhost

DocumentRoot d:/wamp/www

<Directory  "d:/wamp/www/">

Options +Indexes +Includes +FollowSymLinks +MultiViews

AllowOverride All

Require local 

</Directory>

</VirtualHost>

#


改为:

# Virtual Hosts

#

<VirtualHost *:80>

ServerName localhost

ServerAlias localhost

DocumentRoot d:/wamp/www

<Directory  "d:/wamp/www/">

Options +Indexes +Includes +FollowSymLinks +MultiViews

AllowOverride All

Require all granted  

</Directory>

</VirtualHost>

#


更改Apache中的httpd-conf

原来:

<Directory />

AllowOverride All

Require all denied

</Directory>


改为:

<Directory />

AllowOverride None

Options None

Order allow,deny

Allow from all

</Directory>


更改防火墙规则:

控制面板->系统安全->windows防火墙->高级设置->入站规则->新建规则->选择端口->设置特定本地端口(根据自己需要)->下一步->下一步->设置名称

入站规则里面就会包含你刚才设置的端口,重启apache服务,就可以访问了。