由于最近IIS老出问题,早闻Apache的大名,今天下载下来试用了一下,发现果然不错,虽然没有提供IIS那样简单明了的配置界面,但是对于一个人需要来配置服务器的网络管理员来说,我想应该不是什么难事吧!现在把Apache的试用中的一些新的体会写出来,希望对大家有所帮助!
寒假回去把这事给我忘了,刚才重新安装配置了一下,已经成功了,发现还不是很难的事情!不过发现要把Apache和PHP5的配置文件搞清楚还真是一件比较难的事情,主要是因为有时候由于不小心在编辑的时候多敲了一个字符,或是删掉了什么东西的话,要找出来哪里错了简直是大海捞珍啊!下面就把这两个文件中安装配置时需要注意的一些东西给大家列出来。
Apache2.2的配置文件在“setuppath/conf”目录中,
1.服务器的根目录设置
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "G:/Program Files/Apache Software Foundation/Apache2.2"
2.端口设置,由于80端口有可能被IIS占用,为了不与之冲突,我就把监听端口号改为了81
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:81
Listen 81
3.这是为了使用PHP时要加的句子,采用Apache模块DLL工作,效率比以CGI二进制文件方式更快一些,效
更高一些。
######################################################
LoadModule php5_module "G:/Program Files/PHP/php5apache2_2.dll"
4.安装时要输入的设置,其实在这里可以随意改
######################################################
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost:81
5.最重要的目录吧,是存放网站文件及资源的目录
######################################################
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "G:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
6.修改了5中的,这里的也要随之更改
######################################################
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "G:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
7.关于PHP文件类型的设置,其实可以加很多,只要有对应的处理方式就可以了,这样我们就不必一定要把
网页文件的后缀名改为规定的,可以使用你想用的任何名字。
###################################################
AddType application/x-httpd-php .php
PHPIniDir "G:/Program Files/PHP"
PHP5的配置文件由php.ini-recommended改为php.ini而来(其中recommended就是推荐的意思嘛),存放
PHP的安装根目录下。
1.;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Directory in which the loadable extensions (modules) reside.
extension_dir = "G:/Program Files/PHP/ext"
其他的就大家要用的时候再去查吧,两个文件的注释格式不一样,Aapche用的#而PHP5用的;,大家注意
一下!就写到这里吧,下面再写一篇在红帽子上的配置文章吧,希望对大家有说帮助。