1. 程式人生 > >Linux之Xampp外網訪問不了

Linux之Xampp外網訪問不了

我在linux上裝了XAMPP,在linux的瀏覽器上訪問http://localhost獲取設定的靜態IP都沒有問題,但是在windows上的瀏覽器中(區域網內)訪問就不行的,在網上找了很多的方法:

1.編輯httpd-xampp.conf(/opt/lampp/etc/extra/httpd-xampp.conf)檔案
New XAMPP security concept:
Access to the requested directory is only available from the local network.
This setting can be configured in the file “httpd-xampp.conf”.
解決辦法:
開啟httpd-xampp.conf(/xampp/apache/conf/extra/httpd-xampp.conf)
找到以下內容

New XAMPP security concept
<LocationMatch “^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))”>
Order deny,allow
Deny from all
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>

將Deny from all這一行註釋掉,即

#Deny from all

注:需要重啟apache[/opt/lampp/lampp restart]

2.編輯httpd.conf(/opt/lampp/etc/httpd.conf)檔案
找到以下內容:

<Directory />
   AllowOverride none
   Require all denied
</Directory>

改為:

<Directory />
   # AllowOverride none
   # Require all denied
   AllowOverride All
   Require all granted
</Directory>

這樣就可以了

3.關閉防火牆用命令chkconfig iptables off時需要重啟一下電腦重啟下就好了
或者我們要讓防火牆允許遠端的連結來訪問我們搭建的伺服器,伺服器使用的是R埠,我們要讓防火牆開啟R埠

幾種方法我都試啦,剛開始還是一直訪問不了,後來我重啟了一下,就可以了,此時的我也分不清楚是哪一個方法起效了。