您现在的位置是:首页 > cms教程 > Discuz教程Discuz教程
创建论坛Discuz的方法
夏青2025-07-19Discuz教程已有人查阅
导读1.下载discuz!2. 配置第一个虚拟主机3. 配置mysql,给Discuz!增加一个账户4. 安装Discuz!5. 为某个虚拟主机配置用户认证6. 配置域名跳转
1.下载discuz!
删除httpd.conf中的这行前面的警号
给mysql root账户设置密码,然后命令行进入mysql,创建新的库,并创建一个新的帐号对该库有所有权限:
先绑定hosts
192.168.11.190.123.com
浏览器输入:
.123.com/install/
根据提示,修改对应目录的权限
http:// .lishiming.net/thread-554-1-1.html
6. 配置域名跳转
apache 限制指定user_agent http:// .lishiming.net/thread-1033-1-1.html
apache 限制某些目录不能访问通过rewrite实现 http:// .lishiming.net/thread-3587-1-1.html
apache rewrite 出现死循环 http:// .lishiming.net/thread-1043-1-1.html
discuz伪静态配置:
mkdir /data/
cd /data/
wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip
unzip Discuz_X3.2_SC_GBK.zip
mv upload/* .
2. 配置第一个虚拟主机删除httpd.conf中的这行前面的警号
#Include conf/extra/httpd-vhosts.conf
vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
加入如下配置:
<VirtualHost *:80>
DocumentRoot "/data/ "
ServerName.123.com
</VirtualHost>
3. 配置mysql,给Discuz!增加一个账户给mysql root账户设置密码,然后命令行进入mysql,创建新的库,并创建一个新的帐号对该库有所有权限:
> create database discuz;
> grant all on discuz.* to 'aming'@'localhost' identified by '123456aminglinux';
> quit
4. 安装Discuz!先绑定hosts
192.168.11.190.123.com
浏览器输入:
.123.com/install/
根据提示,修改对应目录的权限
cd /data/
chown daemon:daemon data uc_server/data uc_client/data config // 让这几个目录支持apache运行帐号可写
5. 为某个虚拟主机配置用户认证http:// .lishiming.net/thread-554-1-1.html
6. 配置域名跳转
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^ .domain1.com$
RewriteRule ^/(.*)$ http:// .domain2.com/$1 [R=301,L]
</IfModule>
如果是多个域名,可以这样设置:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^ .domain.com [OR]
RewriteCond %{HTTP_HOST} ^ .domain1.com$
RewriteRule ^/(.*)$ http:// .domain2.com/$1 [R=301,L]
</IfModule>
或者:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} !^ .domain2.com$
RewriteRule ^/(.*)$ http:// .domain2.com/$1 [R=301,L]
</IfModule>
7. 配置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. 配置静态文件缓存
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType image/gif "access plus 1 days"
ExpiresByType image/jpeg "access plus 24 hours"
ExpiresByType image/png "access plus 24 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>
或者使用mod_headers模块实现
<ifmodule mod_headers.c>
# htm,html,txt类的文件缓存一个小时
<filesmatch "\.(html|htm|txt)$">
header set cache-control "max-age=3600"
</filesmatch>
# css, js, swf类的文件缓存一个星期
<filesmatch "\.(css|js|swf)$">
header set cache-control "max-age=604800"
</filesmatch>
# jpg,gif,jpeg,png,ico,flv,pdf等文件缓存一年
<filesmatch "\.(ico|gif|jpg|jpeg|png|flv|pdf)$">
header set cache-control "max-age=29030400"
</filesmatch>
</ifmodule>
9. 配置防盗链
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. 访问控制
<Directory /data/ />
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Directory>
针对请求的uri去限制
<filesmatch "(.*)admin(.*)">
Order deny,allow
Deny from all
Allow from 127.0.0.1
</filesmatch>
某个某陆下禁止解析php
<Directory /data/ /path>
php_admin_flag engine off
<filesmatch "(.*)php">
Order deny,allow
Deny from all
</filesmatch>
</Directory>
11. apache rewrite相关apache 限制指定user_agent http:// .lishiming.net/thread-1033-1-1.html
apache 限制某些目录不能访问通过rewrite实现 http:// .lishiming.net/thread-3587-1-1.html
apache rewrite 出现死循环 http:// .lishiming.net/thread-1043-1-1.html
discuz伪静态配置:
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
本文标签:
很赞哦! ()
上一篇:discuz常见问题解决方法介绍
下一篇:Discuz核心函数的解析
图文教程
Discuz中SESSION机制讲解
在Discuz!X中一如继往的,SESSION并没有使用PHP自带的SESSION机制,而是系统的一套自带的机制。在数据库中可以看到有两个SESSION表:
Discuz目录结构分析
admin.php-后台入口文件;api.php-合作API输出接口文件;connect.php-云平台接口文件cp.php-多应用服务入口文件(加载userapp.php文件);crossdomain.xml
Discuz导航和静态化URL设置方法
规范化目录即为URL后面添加斜杠/之前用ISAPI_Rewrite在IIS中伪静态不规范化目录也不会出现链接错误(为了SEO一般是范化目录的规则为:
discuz的.net版本安装方法
.NET版本的DISCUZ的安装和以前的不太一样。不过,不要怕!1:首先下载,解压缩,不用说了。2:加压缩出来2个文件夹,
相关源码
-
(自适应)证书授权书防伪查询系统pbootcms模板本模板基于PbootCMS系统开发,为各类证书查询机构设计,可快速构建高效安全的证书核验平台。采用响应式布局技术,自动适配手机端操作,支持批量导入证书数据,提供便捷的查询接口,满足机构证书管理及用户在线核验需求。查看源码 -
(自适应多语言)WordPress开源主题MirageV资讯个人博客源码MirageV资讯类个人博客主题源码/WordPress主题/全开源MirageV 是一款开源的 WordPress 主题,支持自适应、暗黑模式、多语言等功能,查看源码 -
pbootcms模板(PC+WAP)传媒广告影视公司网站源码基于PbootCMS内核开发的全自适应传媒文化网站模板,为影视公司、广告传媒企业打造,同时支持多行业快速适配。通过替换文字图片即可转换为其他行业网站查看源码 -
(响应式H5)帝国cms7.5文章新闻博客模板带会员中心本模板基于帝国CMS内核开发,为新闻资讯、个人博客及作品展示类网站设计。采用响应式布局技术,确保在手机、平板和电脑等不同设备上都能获得良好的浏览体验。查看源码 -
pbootcms模板(PC+WAP)APP应用软件下载类官网源码为APP应用软件官网打造的响应式解决方案,PC端与移动端(WAP)数据实时同步,一次更新全网生效,满足多终端用户无缝体验需求。查看源码 -
帝国cms7.5个人博客资讯文章模板下载本模板简洁个人博客网站设计开发,采用帝国CMS内核构建,只需替换文字图片即可快速搭建专业网站。自适应手机端设计,数据实时同步,操作简单便捷。PHP程序确保安全稳定运行,帮助您以较低成本获取持续业务。查看源码
| 分享笔记 (共有 篇笔记) |
