php做http服务器配置,基本HTTP服务器的配置

  • Post author:
  • Post category:php


Web服务器域名:www.tarena.com

默认首页包括:index.html、index.php

开启保持连接

确认默认httpd是否支持php

网站用老师提供的test_web.zip测试

服务器操作:

1、备份主配置文件

[root@localhost~]# cd /etc/httpd/conf               //进入主配置目录

[root@localhostconf]#cphttpd.confhttpd.conf.bak  //修改配置文件时,先备份

2、修改主配置文件

[root@localhost~]# vim /etc/httpd/conf/httpd.conf

74行:KeepAlive On

265行:ServerName www.tarena.com:80

391行:DirectoryIndex index.htmlindex.php

3、启动服务

[root@localhost~]# servicehttpd restart

[root@localhost~]# chkconfighttpd on

[root@localhost~]# rpm -q samba-client

samba-client-3.0.33-3.39.el5_8

[root@localhost~]# mkdir -p  /data/lele

4、注意:Win7共享时将Win7目录下的D:\阶段2所需软件设置共享,共享名称为two,首先将Win7的防火墙关闭,(网络—右键(属性)—windows防火墙)网段相同,能相互ping通。

[root@localhost~]# mount -o username=administrator //192.168.10.200/two  /data/lele

Password:   //输入Win7密码

[root@localhost~]# df -HT

文件系统      类型     容量   已用  可用 已用% 挂载点

//192.168.10.200/twocifs      86G   44G    42G  51% /data/lele

[root@localhost~]# cd /data/lele

[root@localhostlele]#ls

AdobeReader_chs-8.1.2-1.i486.tar.gz          linuxqq-v1.0.2-beta1.i386.rpm

aria2-1.17.1.tar.gz                          ntfs-3g.rar

awstats-7.1.tar.gzPUTTY.EXE

FileZilla_3.7.0.2_win32-setup.exe            RealPlayer11GOLD.rpm

fm713chb52_build_setup.exe                   securecrt.zip

httpd-2.2.25.tar.gztest_web.zip

kernel-2.6.32.61-5.x86_64.rpm                webmin-1.630.tar.gz

LibreOffice_4.1.1.2_Linux_x86-64_rpm.tar.gz  WinISO.rar

linux-2.6.32.61.tar.xz                       Xshell4.0_CN.zip

[root@localhostlele]#cd /var/www/html

[root@localhosthtml]# unzip /data/lele/test_web.zip

[root@localhosthtml]# ls

jiajutiyansirbiz

5、客户机验证:

http://192.168.10.253/jiajutiyan/

3deb12bdea6d303b6e1bd13c67548d5d.png

http://www.tarena.com/jiajutiyan/

1079d0da19fb2107aaae3586209b3417.png

6、编写测试php页面

[root@localhost~]# cd /var/www/html/

[root@localhosthtml]# touch test.php

[root@localhosthtml]# vimtest.php

[root@localhost~]# cat /var/www/html/test.php

phpinfo();

?>

7、客户机php登录测试:

http://www.tarena.com/test.php

http://192.168.10.253/test.php