Centos5.5+LAMP环境
Note:如果网络正常,apache服务正常,仍然不能访问网页。需要检查linux 防火墙是否关闭。
(
先重新启动防火墙
service iptables start
然后输入配置防火墙的命令并查看配置后的防火墙策略
iptables -I INPUT -p TCP --dport 80 -j ACCEPT
service iptables status
完成后如图所示,配置完成,远程访问服务器上的网页已经OK了
)
1.安装apache
[root@admin-pc mnt]# yum -y install httpd*
2.创建默认index.html页面(默认没有index.html页面)
[root@admin-pc mnt]# vi /var/www/html/index.html
<html>
<body>
this is a test a page for apache
</body>
</html>
3.enable ip访问在配置文件中
[root@admin-pc mnt]# vi /etc/httpd/conf/httpd.conf
ServerName www.example.com:80
4.重新启动 apache服务
[root@admin-pc mnt]# /etc/init.d/httpd stop
[root@admin-pc mnt]# /etc/init.d/httpd start
5.打开浏览器http://192.168.1.11/index.html
#安装mysql
1.[root@admin-pc mnt]# yum -y install mysql mysql-server
2.登录mysql(默认用户名和密码为空)
3.修改用户名和密码为root 123
[root@admin-pc mnt]# mysqladmin -u root -p password 123
4,重新登录mysql
[root@admin-pc mnt]# mysql -uroot -p123
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 67
Server version: 5.0.95 Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
#安装 php
1.yum安装php
[root@admin-pc mnt]# yum -y install php*
2.创建index.php页面
[root@admin-pc mnt]# vi /var/www/html/index.php
3.编辑index.php页面
<?php
phpinfo();
?>
4.打开浏览器http://192.168.1.11/index.php