天天看點

WampServer配置區域網路通路的站點

首先運作Wampserver,滑鼠左鍵點選電腦右下角的小圖示會彈出下面的視窗,我們要配置的是左邊的httpd.conf和httpd-vhosts.conf檔案

WampServer配置區域網路通路的站點

httpd.conf檔案

1.找到Require local,替換成Require all granted

2.打開cmd(按住window+R,然後輸入cmd按回車會彈出來),輸入netstat –ano|findstr 6566,看看端口号有沒有被占用

    如果被占用了,看下被哪個程式占用。

    netstat -ano,列出所有端口的情況

    檢視被占用端口對應的PID,輸入指令:netstat -aon|findstr "6566"  回車,結果PID是2720

    繼續輸入tasklist|findstr "2720",回車,檢視是哪個程序或者程式占用了2720端口,此時就可以看到結果了

    或者在任務管理器中“詳細資訊“裡面根骨PID也可以看到是哪個程序

3.如果該端口号沒有被趙勇就将這倆行最後面的80改成6566(端口号自己設定)

WampServer配置區域網路通路的站點

更改完成後,儲存關閉 httpd.conf檔案

httpd-vhosts.conf檔案做如下更改(紅字部分)

WampServer配置區域網路通路的站點

最後重新開機WampServer,在手機上通路http://192.168.2.67:6566/,就可以看到和 電腦上一樣的界面了(要在同一個區域網路内)

常見錯誤:wampserver apache 403無權限通路 You don't have permission to access ...

在 httpd.conf 裡面Require all denied改成Require all granted

<Directory />

AllowOverride none

Require all denied

</Directory>

<Directory />

    AllowOverride none

    Require all granted

</Directory>

然後在 httpd-vhosts.conf裡面

# Virtual Hosts
#
<VirtualHost *:4000>
  ServerName 192.168.31.63
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local //此處替換成 Require all granted
  </Directory>
</VirtualHost>
           

繼續閱讀