PHP&MYSQL For win32 版服务器配置说明(1)(2)
五、配置apache
打开apache\conf\httpd.conf文件,以下为主要设置
ServerType standalone
ServerRoot "d:/apache"
# apache安装的目录
PidFile logs/httpd.pid
ScoreBoardFile logs/apache_runtime_status
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MaxRequestsPerChild 1024
ThreadsPerChild 50
SendBufferSize 65536
MaxClients 150
Listen 80
# 监听80端口,默认web server端口
BindAddress *
# 在任何ip均可以使用web server
LoadModule vhost_alias_module modules/mod_vhost_alias.so
AddModule mod_vhost_alias.c
# 去掉这两行前面的#,开启虚拟域名的支持
Port 80
ServerAdmin me@localhost
ServerName localhost
# 端口、管理员email,服务器域名,按实际修改
DocumentRoot "d:/myweb/"
# web文件保存地址,这里是以d:/myweb作为例子
Options FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
# 设置d:/myweb的访问选项
ScriptAlias /cgi-bin "e:/myweb/cgi"
AllowOverride None
Options None
Order allow,deny
Allow from all
# 设置cgi-bin目录权限
#!/perl/bin/perl
# 这一行配置perl-cgi的运行环境,由于Active Perl安装在d:\perl,所以这里直接使用相对路径
# 注意,要运行的cgi、pl文件的头一行要和这里相同,否则不能运行。这里也可以写成
# #!d:/perl/bin/perl
# 另外这个配置第一个#不代表注释的意思,所以不能省略!!
查找DirectoryIndex index.html,在下面添加
DirectoryIndex index.htm
DirectoryIndex default.htm
DirectoryIndex default.html
DirectoryIndex index.php
DirectoryIndex index.php3
DirectoryIndex index.cgi
查找AddType application/x-httpd-php
修改为AddType application/x-httpd-php .php .phtml .php3
查找AddHandler cgi-script
修改为AddHandler cgi-script .cgi .pl
LoadModule php4_module d:/php/sapi/php4apache.dll
LoadModule gzip_module d:/apache/modules/apacheModuleGzip.dll
# 加载php4,gzip模块
### 以下为gzip模块设置
mod_gzip_on Yes
mod_gzip_minimum_file_size 300
mod_gzip_maximum_file_size 0
mod_gzip_maximum_inmem_size 100000
mod_gzip_keep_workfiles No
mod_gzip_dechunk Yes
mod_gzip_can_negotiate Yes
mod_gzip_temp_dir d:/apache/temp
# 必须在apache目录下面有一个temp目录,没有就新建一个
mod_gzip_item_include file \.html$
mod_gzip_item_include file \.htm$
mod_gzip_item_include file \.shtml$
mod_gzip_item_include file \.shtm$
mod_gzip_item_include file \.pl$
mod_gzip_item_include file \.cgi$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include handler ^perl-script$
mod_gzip_item_include mime ^httpd/unix-directory$
mod_gzip_item_include handler ^server-status$
mod_gzip_item_include handler ^server-info$
mod_gzip_item_include mime ^application/x-httpd-php
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.php3$
mod_gzip_item_include file \.mht$
mod_gzip_item_exclude file \.css$
mod_gzip_item_exclude file \.js$
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude reqheader Content-Type:multipart/form-data
mod_gzip_item_exclude reqheader Content-Type:application/x-www-form-urlencoded
mod_gzip_item_exclude file \attachment.php$
#上面这个是VBB必须要的
### End of mod_gzip sample config
LogFormat "%h %l %u %t \"%r\" %>s %b mod_gzip: %{mod_gzip_result}n In:%{mod_gzip_input_size}n Out:%{mod_gzip_output_size}n:%{mod_gzip_compression_ratio}npct." mod_gzip_info
# 记录gzip运行情况
# 以上为httpd.conf需要添加或者修改的地方,其他不用修改可以了






