解决xampp 外网访问不了

装完xampp5.6 后发现局域网(外网)不能访问!

这个问题困扰我很久,在网上找,修改http.conf http-xampp.conf 等都没效果‘

而且网上大部分解决办法,包括官网上写的也是

<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
Order deny,allow
#Deny from all
Allow from 127.0.0.0/8
ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
</LocationMatch>

我真想骂人! 因为这些文件根本就没有什么<locationMatch></locationMatch>好吗?

原因我想是 很久之前的版本的xampp了! 看来更新的太慢了,现在人都不解决这个问题了。

后来找到一个和我一样问题的。http://blog.csdn.net/Yade_Lei/article/details/52081907

确实应该考虑防火墙的设置

方法1.界面配置,在CentOS7 ->杂项->防火墙软 设置 但是看起来比较复杂,可以参考http://blog.csdn.net/xlgen157387/article/details/52672988

在 CentOS 7
暫時開放 ftp 服務
#firewall-cmd --add-service=ftp

永久開放 ftp 服務
#firewall-cmd --add-service=ftp --permanent
永久關閉
#firewall-cmd --remove-service=ftp --permanent
success

讓設定生效
#systemctl restart firewalld

檢視設定是否生效
#iptables -L -n | grep 21
ACCEPTtcp--0.0.0.0/00.0.0.0/0tcp dpt:21 ctstate NEW

檢查防火牆狀態
# firewall-cmd --state
running

systemctl stop firewalld
not running
firewall-cmd --list-all
public (default)
interfaces:
sources:
services: dhcpv6-client ftp ssh
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:
在 FirewallD 的服務名稱
firewall-cmd --get-service
amanda-client bacula bacula-client dhcp dhcpv6 dhcpv6-client dns ftp high-availability http https imaps ipp ipp-client ipsec kerberos kpasswd ldap ldaps libvirt libvirt-tls mdns mountd ms-wbt mysql nfs ntp openvpn pmcd pmproxy pmwebapi pmwebapis pop3s postgresql proxy-dhcp radius rpc-bind samba samba-client smtp ssh telnet tftp tftp-client transmission-client vnc-server wbem-https
查詢服務的啟用狀態
firewall-cmd --query-service ftp
yes
firewall-cmd --query-service ssh
firewall-cmd --query-service samba
no
firewall-cmd --query-service http
自行加入要開放的 Port
firewall-cmd --add-port=3128/tcp
ports:3128/tcp

rich rules:

总结:基本上2种指令就OK了

firewall-cmd --add-service=

firewall-cmd --add-ports=


方法2:配置iptables,

如果没有装运行:yum install iptables-services

可以看防火墙状态: systemctl status iptables.service

可以看防火墙是否是活动的。


解决方法来了:

执行:gedit /etc/sysconfig/iptables

添加命令:

#SSH
-A INPUT -p tcp --dport 22 -j ACCEPT
#HTTP
-A INPUT -p tcp --dport 80 -j ACCEPT
-A INPUT -p tcp --dport 8080 -j ACCEPT
#HTTPS
-A INPUT -p tcp --dport 443 -j ACCEPT
#POP3
-A INPUT -p tcp --dport 110 -j ACCEPT
#SMTP
-A INPUT -p tcp --dport 25 -j ACCEPT
#FTP
-A INPUT -p tcp --dport 21 -j ACCEPT
-A INPUT -p tcp --dport 20 -j ACCEPT
#DNS
-A INPUT -p tcp --dport 53 -j ACCEPT

执行:systemctrl restart iptables.service 启动防火墙端口

4、添加开机自启动,默认不会 开启启动

执行:systemctl enable iptables.service#设置防火墙开机启动

但是开机后:查看是否启动:systemctl status iptables.service

显示的是enable 但是 Active :inactive(dead)

表示未成功启动,原因是没有屏蔽firewalld防火墙,执行

systemctl stop firewalld
systemctl mask firewalld
解决!

相关文章

linux下开机自启: 在/etc/init.d目录下新建文件elasticsear...
1、因为在centos7中/etc/rc.d/rc.local的权限被降低了,所以...
最简单的查看方法可以使用ls -ll、ls-lh命令进行查看,当使用...
ASP.NET Core应用程序发布linux在shell中运行是正常的。可一...
设置时区(CentOS 7) 先执行命令timedatectl status|grep &...
vim&#160;/etc/sysconfig/network-scripts/ifcfg-eth0 B...