服务器系统环境:CentOS 6.3
客户端系统环境:Windows 7 ultimate(x86)sp1 简体中文旗舰版
※ 本文档描述了如何在Linux服务器配置Apache、Mysql、PHP5
LAMP(Linux-Apache-MySQL-PHP)网站架构是目前国际流行的Web框架,该框架包括:Linux操作系统,Apache网络服务器,MySQL数据库,Perl、PHP或者Python编程语言,所有组成产品均是开源软件,是国际上成熟的架构框架,很多流行的商业应用都是采取这个架构,和Java/J2EE架构相比,LAMP具有Web资源丰富、轻量、快速开发等特点,微软的.NET架构相比,LAMP具有通用、跨平台、高性能、低价格的优势,因此LAMP无论是性能、质量还是价格都是企业搭建网站的首选平台。
安装前准备:
1、检查防火墙iptables状态
[root@server ~]# service iptables status
注意:用法:iptables {start|stop|restart|condrestart|status|panic|save}
表格:filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
5 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
查看本机关于 IPTABLES的配置前情况
[root@server ~]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
target prot opt source destination
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
2、配置防火墙,开启80端口、3306端口
[root@server ~]# vim /etc/sysconfig/iptables
添加:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #允许80(http)端口通过防火墙
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT #允许3306(mysql)端口通过防火墙
备注:
很多网友把这两条规则添加到防火墙配置的最后一行,导致防火墙启动失败,正确的应该是添加到默认的22端口这条规则的下面。
如下所示:
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #允许80(http)端口通过防火墙
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT #允许3306(mysql)端口通过防火墙
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
:wq #保存退出
重启防火墙使配置生效
[root@server ~]# service iptables restart
iptables:清除防火墙规则: [确定]
iptables:将链设置为政策 ACCEPT:filter [确定]
iptables:正在卸载模块: [确定]
iptables:应用防火墙规则: [确定]
最后,检查防火墙iptables状态是否生效
[root@server ~]# service iptables status
表格:filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
3 ACCEPT all -- 0.0.0.0/0 &nbs
关键词标签:CentOS,Linux,Apache,MySQL,PHP5
相关阅读 CentOS vsftpd使用安装与配置问题 minicom软件在CentOS系统中使用 简介CentOS配置ssh系统技术 CentOS操作系统安装教程 CentOS 5.1系统下挂载NTFS分区 CentOS 5.1 做NAT代理,实现封迅雷,BT,pplive.
热门文章
ISAPI Rewrite实现IIS图片防盗链
IIS6.0下配置MySQL+PHP5+Zend+phpMyAdmin
在Windows服务器上快速架设视频编解码器全攻略
win2000server IIS和tomcat5多站点配置
时间:2022-08-04 19:05:57
时间:2022-08-04 18:35:11
时间:2020-09-14 18:46:57
时间:2020-09-14 18:46:26
时间:2020-08-08 12:07:40
时间:2020-08-08 12:06:35
人气排行 XAMPP配置出现403错误“Access forbidden!”的解决办法 WIN2003 IIS6.0+PHP+ASP+MYSQL优化配置 访问网站403错误 Forbidden解决方法 如何从最大用户并发数推算出系统最大用户数 Server Application Unavailable的解决办法 报错“HTTP/1.1 400 Bad Request”的处理方法 Windows Server 2003的Web接口 http 500内部服务器错误的解决办法(windows xp + IIS5.0)
查看所有1条评论>>