Apache主配置文件为:/usr/local/apache2/conf/httpd.conf
# vim /usr/local/apache2/conf/httpd.conf
找到:
AddType application/x-gzip .gz .tgz
在该行下面添加
AddType application/x-httpd-php .php
找到:
DirectoryIndex index.html
将该行改为
DirectoryIndex index.html index.htm index.php
找到:
#Include conf/extra/httpd-mpm.conf
#Include conf/extra/httpd-info.conf
#Include conf/extra/httpd-vhosts.conf
#Include conf/extra/httpd-default.conf
去掉前面的“#”号,取消注释。
# vim /usr/local/apache2/conf/httpd.conf
找到:
AddType application/x-gzip .gz .tgz
在该行下面添加
AddType application/x-httpd-php .php
找到:
DirectoryIndex index.html
将该行改为
DirectoryIndex index.html index.htm index.php
找到:
#Include conf/extra/httpd-mpm.conf
#Include conf/extra/httpd-info.conf
#Include conf/extra/httpd-vhosts.conf
#Include conf/extra/httpd-default.conf
去掉前面的“#”号,取消注释。
0
配置Apache进程管理
配置文件为:/usr/local/apache2/conf/extra/httpd-mpm.conf
将配置文件中下面一段修改为如下:
ServerLimit 2048 新添加的一样
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 1024 默认最大为256,设置为超过256必须增加有ServerLimit
MaxRequestsPerChild 0
配置Apache的server-status
配置文件为:/usr/local/apache2/conf/extra/httpd-info.conf
将配置文件中下面一段修改为如下:
SetHandler server-status
Order deny,allow
Deny from all
Allow from all
配置Apache虚拟主机
配置文件为:/usr/local/apache2/conf/extra/httpd-vhosts.conf
将配置文件中下面一段修改为如下:
# ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/www/wwwroot/supesite"
ServerName www.example.com.cn
ErrorLog "|/usr/local/cronolog/sbin/cronolog /www/logs/supesite/error.log-%Y%m%d"
CustomLog "|/usr/local/cronolog/sbin/cronolog /www/logs/supesite/access.log-%Y%m%d" combined
//discuz 论坛使用的rewrite规则
RewriteEngine On
RewriteRule ^/([0-9]+)/spacelist(.+)$ /index.php?uid/$1/action/spacelist/type$2 [L]
RewriteRule ^/([0-9]+)/viewspace(.+)$ /index.php?uid/$1/action/viewspace/itemid$2 [L]
RewriteRule ^/([0-9]+)/viewbbs(.+)$ /index.php?uid/$1/action/viewbbs/tid$2 [L]
RewriteRule ^/([0-9]+)/(.*)$ /index.php?uid/$1/$2 [L]
RewriteRule ^/([0-9]+)$ /index.php?uid/$1 [L]
RewriteRule ^/action(.+)$ /index.php?action$1 [L]
RewriteRule ^/category(.+)$ /index.php?action/category/catid$1 [L]
RewriteRule ^/viewnews(.+)$ /index.php?action/viewnews/itemid$1 [L]
RewriteRule ^/viewthread(.+)$ /index.php?action/viewthread/tid$1 [L]
RewriteRule ^/mygroup(.+)$ /index.php?action/mygroup/gid$1 [L]
说明:
ServerAdmin 参数后为管理员email
DocumentRoot 指的是论坛文件存放的目录
ServerName 是论坛的域名
ErrorLog 是论坛错误日志 通过管道使用cronolog工具将日志切割为每天一个文件
CustomLog 是论坛访问日志 通过管道使用cronolog工具将日志切割为每天一个文件
和 包含的字段是rewrite部分,实现URL静态化
配置Apache缺省httpd设置
配置文件为:/usr/local/apache2/conf/extra/httpd-default.conf
将配置文件中下面一段:
将KeepAlive On 改为KeepAlive Off
配置完上述内容之后,重新启动Apache:
# /usr/local/apache2/bin/apachectl restart
配置文件为:/usr/local/apache2/conf/extra/httpd-mpm.conf
将配置文件中下面一段修改为如下:
ServerLimit 2048 新添加的一样
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 1024 默认最大为256,设置为超过256必须增加有ServerLimit
MaxRequestsPerChild 0
配置Apache的server-status
配置文件为:/usr/local/apache2/conf/extra/httpd-info.conf
将配置文件中下面一段修改为如下:
SetHandler server-status
Order deny,allow
Deny from all
Allow from all
配置Apache虚拟主机
配置文件为:/usr/local/apache2/conf/extra/httpd-vhosts.conf
将配置文件中下面一段修改为如下:
# ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/www/wwwroot/supesite"
ServerName www.example.com.cn
ErrorLog "|/usr/local/cronolog/sbin/cronolog /www/logs/supesite/error.log-%Y%m%d"
CustomLog "|/usr/local/cronolog/sbin/cronolog /www/logs/supesite/access.log-%Y%m%d" combined
RewriteEngine On
RewriteRule ^/([0-9]+)/spacelist(.+)$ /index.php?uid/$1/action/spacelist/type$2 [L]
RewriteRule ^/([0-9]+)/viewspace(.+)$ /index.php?uid/$1/action/viewspace/itemid$2 [L]
RewriteRule ^/([0-9]+)/viewbbs(.+)$ /index.php?uid/$1/action/viewbbs/tid$2 [L]
RewriteRule ^/([0-9]+)/(.*)$ /index.php?uid/$1/$2 [L]
RewriteRule ^/([0-9]+)$ /index.php?uid/$1 [L]
RewriteRule ^/action(.+)$ /index.php?action$1 [L]
RewriteRule ^/category(.+)$ /index.php?action/category/catid$1 [L]
RewriteRule ^/viewnews(.+)$ /index.php?action/viewnews/itemid$1 [L]
RewriteRule ^/viewthread(.+)$ /index.php?action/viewthread/tid$1 [L]
RewriteRule ^/mygroup(.+)$ /index.php?action/mygroup/gid$1 [L]
说明:
ServerAdmin 参数后为管理员email
DocumentRoot 指的是论坛文件存放的目录
ServerName 是论坛的域名
ErrorLog 是论坛错误日志 通过管道使用cronolog工具将日志切割为每天一个文件
CustomLog 是论坛访问日志 通过管道使用cronolog工具将日志切割为每天一个文件
配置Apache缺省httpd设置
配置文件为:/usr/local/apache2/conf/extra/httpd-default.conf
将配置文件中下面一段:
将KeepAlive On 改为KeepAlive Off
配置完上述内容之后,重新启动Apache:
# /usr/local/apache2/bin/apachectl restart
编辑回复