Linux必须是32位,因为XAMPP只支持32
安装Discuz的最佳PHP版本是5.3、MySQL版本是5.5
XAMPP 和PHP、MySQL对应关系如下
http://baike.baidu.com/view/864591.htm
所以最佳的XAMPP版本是1.7.7
搭建环境主要参考下面这篇文章
http://blog.csdn.net/reblue520/article/details/9037319
其中的解压XAMPP语句有错
tar -xvfz xampp-linux-1.7.3a.tar.gz -C /opt
改成
tar -zxvf xampp-linux-1.7.3a.tar.gz -C /opt
路径不能随便更改
在httpd.conf中取消Include etc/extra/httpd-vhosts.conf的注释
Discuz静态化参考这篇文章
http://www.discuz.net/thread-3191765-1-1.html
要注意是把Apache Web Server(独立主机用户)配置复制到httpd-vhosts.conf中,不需要创建.htaccess
示例
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
DocumentRoot /opt/lampp/htdocs/discuz
ServerName x.com
ServerAlias www.x.com
ErrorLog logs/x.com-error_log
CustomLog logs/x.com-access_log common
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3&%1
</IfModule>
</VirtualHost>
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host2.example.com
# DocumentRoot /www/docs/dummy-host2.example.com
# ServerName dummy-host2.example.com
# ErrorLog logs/dummy-host2.example.com-error_log
# CustomLog logs/dummy-host2.example.com-access_log common
#</VirtualHost>