1. Download discuz!
Mkdir/data/www
Cd/data/www
wget Http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip
Unzip Discuz_x3.2_sc_gbk.zip
MV upload/*.
2. Configure the first virtual host
Remove the siren in front of this line in httpd.conf
#Include conf/extra/httpd-vhosts.conf
Vim/usr/local/apache2/conf/extra/httpd-vhosts.conf
Add the following configuration:
<virtualhost *:80>
DocumentRoot "/data/www"
ServerName www.123.com
</VirtualHost>
3. Configure MySQL to discuz! Add an Account
Set a password to the MySQL root account, then the command line enters MySQL, creates a new library, and creates a new account with all the permissions for the library:
> CREATE Database Discuz;
> Grant all on discuz.* to ' aming ' @ ' localhost ' identified by ' 123456aminglinux ';
> Quit
4. Installing discuz!
Bind hosts First
192.168.11.190 www.123.com
Browser input:
www.123.com/install/
Modify permissions for the corresponding directory as prompted
Cd/data/www
Chown Daemon:daemon data uc_server/data uc_client/data Config//Let these directories support Apache run account writable
5. Configure user authentication for a virtual host
Http://www.lishiming.net/thread-554-1-1.html
6. Configure the domain name jump
<ifmodule mod_rewrite.c>
Rewriteengine on
Rewritecond%{http_host} ^www.domain1.com$
Rewriterule ^/(. *) $ http://www.domain2.com/$1 [r=301,l]
</IfModule>
If you have more than one domain name, you can set this:
<ifmodule mod_rewrite.c>
Rewriteengine on
Rewritecond%{http_host} ^www.domain.com [OR]
Rewritecond%{http_host} ^www.domain1.com$
Rewriterule ^/(. *) $ http://www.domain2.com/$1 [r=301,l]
</IfModule>
Or: <ifmodule mod_rewrite.c>
Rewriteengine on
Rewritecond%{http_host}!^www.domain2.com$
Rewriterule ^/(. *) $ http://www.domain2.com/$1 [r=301,l]
</IfModule>
7. Configure access logs for Apache
Errorlog "|/usr/local/apache/bin/rotatelogs-l/usr/local/apache/logs/oem.discuz.qq.com-error_%y%m%d.log 86400"
Setenvif Request_uri ". *\.gif$" Image-request
Setenvif Request_uri ". *\.jpg$" Image-request
Setenvif Request_uri ". *\.png$" Image-request
Setenvif Request_uri ". *\.bmp$" Image-request
Setenvif Request_uri ". *\.swf$" Image-request
Setenvif Request_uri ". *\.js$" Image-request
Setenvif Request_uri ". *\.css$" Image-request
Customlog "|/usr/local/apache/bin/rotatelogs-l/usr/local/apache/logs/oem.discuz.qq.com-access_%y%m%d.log 86400" Combined Env=!image-request
8. Configure the static file cache
<ifmodule mod_expires.c>
Expiresactive on
Expiresbytype image/gif "Access plus 1 days"
Expiresbytype image/jpeg "Access plus hours"
Expiresbytype image/png "Access plus hours"
Expiresbytype text/css "Now plus 2 hour"
Expiresbytype Application/x-javascript "now plus 2 hours"
Expiresbytype Application/javascript "now plus 2 hours"
Expiresbytype Application/x-shockwave-flash "now plus 2 hours"
ExpiresDefault "now plus 0 min"
</IfModule>
Or use the Mod_headers module to implement
<ifmodule mod_headers.c>
# File cache for Htm,html,txt class one hours
<filesmatch "\. (html|htm|txt) $ ">
Header set Cache-control "max-age=3600"
</filesmatch>
# CSS, JS, SWF class file cache for one weeks
<filesmatch "\. (css|js|swf) $ ">
Header set Cache-control "max-age=604800"
</filesmatch>
# jpg,gif,jpeg,png,ico,flv,pdf file cache for one year
<filesmatch "\. (ico|gif|jpg|jpeg|png|flv|pdf) $ ">
Header set Cache-control "max-age=29030400"
</filesmatch>
</ifmodule>
9. Configure the anti-theft chain
Setenvifnocase Referer "^http://.*\.yourdomin\.com" Local_ref
Setenvifnocase Referer ". *\.yourdomin\.com" Local_ref
Setenvifnocase Referer "^$" Local_ref
<filesmatch "\. (txt|doc|mp3|zip|rar|jpg|gif) ">
Order Allow,deny
Allow from Env=local_ref
</filesmatch>
10. Access Control
<Directory/data/www/>
Order Deny,allow
Deny from all
Allow from 127.0.0.1
</Directory>
To restrict the URI of the request
<filesmatch "(. *) admin (. *)" >
Order Deny,allow
Deny from all
Allow from 127.0.0.1
</filesmatch>
A certain land under prohibit parsing PHP
<Directory/data/www/path>
Php_admin_flag engine off
<filesmatch "(. *) PHP" >
Order Deny,allow
Deny from all
</filesmatch>
</Directory>
Apache Rewrite related
Apache restricts the specified user_agent http://www.lishiming.net/thread-1033-1-1.html
Apache restricts certain directories from being accessed through rewrite implementation http://www.lishiming.net/thread-3587-1-1.html
Apache rewrite appears dead Loop http://www.lishiming.net/thread-1043-1-1.html
Discuz pseudo-static configuration:
Rewritecond%{query_string} ^ (. *) $
Rewriterule ^/topic-(. +) \.html$/portal.php?mod=topic&topic=$1&%1
Rewritecond%{query_string} ^ (. *) $
Rewriterule ^/article-([0-9]+)-([0-9]+) \.html$/portal.php?mod=view&aid=$1&page=$2&%1
Rewritecond%{query_string} ^ (. *) $
Rewriterule ^/forum-(\w+)-([0-9]+) \.html$/forum.php?mod=forumdisplay&fid=$1&page=$2&%1
Rewritecond%{query_string} ^ (. *) $
Rewriterule ^/thread-([0-9]+)-([0-9]+)-([0-9]+] \.html$/forum.php?mod=viewthread&tid=$1&extra=page\%3d$3 &page=$2&%1
Rewritecond%{query_string} ^ (. *) $
Rewriterule ^/group-([0-9]+)-([0-9]+) \.html$/forum.php?mod=group&fid=$1&page=$2&%1
Rewritecond%{query_string} ^ (. *) $
Rewriterule ^/space-(Username|uid)-(. +) \.html$/home.php?mod=space&$1=$2&%1
Rewritecond%{query_string} ^ (. *) $
Rewriterule ^/blog-([0-9]+)-([0-9]+) \.html$/home.php?mod=space&uid=$1&do=blog&id=$2&%1
Rewritecond%{query_string} ^ (. *) $
Rewriterule ^/archiver/(Fid|tid)-([0-9]+) \.html$/archiver/index.php?action=$1&value=$2&%1
Rewritecond%{query_string} ^ (. *) $
Rewriterule ^/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+) \.html$/plugin.php?id=$1:$2&%1
Lamp Part II Apache configuration