创建论坛Discuz
下载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. 配置第一个虚拟主机
删除httpd.conf中的这行前面的警号
#Include conf/extra/httpd-vhosts.conf
vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
加入如下配置:
<VirtualHost *:80>
DocumentRoot "/data/www"
ServerName www.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 www.123.com
浏览器输入:
www.123.com/install/
根据提示,修改对应目录的权限
cd /data/www
chown daemon:daemon data uc_server/data uc_client/data config // 让这几个目录支持apache运行帐号可写
5. 为某个虚拟主机配置用户认证
http://www.lishiming.net/thread-554-1-1.html
6. 配置域名跳转
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.domain1.com$
RewriteRule ^/(.*)$ http://www.domain2.com/$1 [R=301,L]
</IfModule>
如果是多个域名,可以这样设置:
<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>
或者: <IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.domain2.com$
RewriteRule ^/(.*)$ http://www.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/www/>
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/www/path>
php_admin_flag engine off
<filesmatch "(.*)php">
Order deny,allow
Deny from all
</filesmatch>
</Directory>
11. apache rewrite相关
apache 限制指定user_agent http://www.lishiming.net/thread-1033-1-1.html
apache 限制某些目录不能访问通过rewrite实现 http://www.lishiming.net/thread-3587-1-1.html
apache rewrite 出现死循环 http://www.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的更多相关文章
- Linux服务器---论坛discuz
Discus Discuz是一款免费的论坛管理系统,大量的使用了AJAX,内部有丰富的模板风格. 1.下载discuz软件(https://cn.wordpress.org/download/rele ...
- LAMP-五分钟搭建个人论坛
LAMP-五分钟搭建个人论坛 系统版本:CentOS7 1.##安装lamp及依赖软件wget http://repo.mysql.com/mysql-community-release-el7-5. ...
- Discuz的安装与使用
Discuz的安装与使用 一.Discuz的安装 由于本机已经安装好XAMPP集成工具,后续Discuz访问数据库以及服务器等都是基于XAMPP环境.在主机localhost根目录下新建bbs文件夹. ...
- lnamp环境搭建博客、论坛
实验环境:Centos6.5 源码安装Nginx yum安装Apache.php.Mysql Mysql: yum -y install mysql-server 安装Mysql数据库 /etc/i ...
- ubuntu下搭建Discuz
环境:我用桥接方式创建了一个ubuntu16的虚拟机,ip为192.168.0.220 1.安装mysql sudo apt-get install mysql-server mysql-cl ...
- ubuntu安装discourse论坛----结合在apache服务上建立虚拟主机
指导操作:https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md 一.先安装 Docker / Git: wg ...
- discuz 用户整合 账号整合 ucenter php网站整合discuz用户
引用:https://www.cnblogs.com/kenkofox/archive/2011/09/18/2180649.html 1.登录后台管理.(在论坛中,用创建论坛的admin账号登陆,然 ...
- discuz之搭建
本篇将介绍IIS+MySQL+DiscuzX3.1+UCenter1.6+Asp.Net+PHP的部署 大部分都是搬运过来的,当然我会注明搬运地点 搭建 首先说明本机基本信息 系统========== ...
- lamp论坛搭建
1.配置本地yum源 mount 2.安装软件 yum install httpd mariadb mariadb-server php php-mysql php-gd libjpeg* ...
随机推荐
- MongoDB资料汇总
MongoDB是一个基于分布式文件存储的数据库.由C++语言编写.旨在为WEB应用提供可扩展的高性能数据存储解决方案. 它的特点是高性能.易部署.易使用,存储数据非常方便.主要功能特性有: 面向集合存 ...
- FTP常用故障代码注解
FTP错误列表 出处:http://bbs.enet.com.cn/UserControl?act=13&threadID 作者: |秒杀』| 详细的FTP错误列表 Restart marke ...
- Redis基础知识之——自定义封装单实例和普通类Redis
一.普通Redis实例化类: class MyRedis { private $redis; public function __construct($host = '121.41.88.209', ...
- spring事务知识
事务的传播行为? 在Spring 的事务中, _可以通过 propagation 来定义事务的传播行为_: PROPAGATION_required:如果当前没有事务,就新建一个事务,如果已经存在一个 ...
- poj1556The Doors
链接 枚举两点 若不和任何线段相交 建边为dis(i,j) floyd求最短路 #include <iostream> #include<cstdio> #include< ...
- 在Windows上安装MySQL5.7
1. 下载安装包,这里选择压缩版mysql-5.7.16-winx64.zip: http://dev.mysql.com/downloads/mysql/ 2. 解压到安装目录,注意最好不要含有中文 ...
- (一)S5PV210开发板常用易忘操作记录
一.调试串口 2.SD卡槽 (三)启动方式选择 蜂鸣器下面的白色2针插座(图中红色线圈出来的那个)为选择USB/SD卡启动的开关.默认情况下为SD卡启动,如果需要USB启动则使用短路帽(若没有短路帽, ...
- jQuery中$.post()的使用
$.post()方法是jquery本身对ajax的一个简单封装,其效果等价于: $.ajax({ url:url, type:"POST", data:data, dataType ...
- SciTE 文本编辑器
个人一直使用,强大,轻型基于 Scintilla. http://www.scintilla.org/SciTEDownload.html 解压缩后,能右键文件打开 修改注册表, 使能资源管理器 右键 ...
- iOS开发 自定义窗口 以及 点击scrollView置顶
static UIWindow *topWindow_; static UIScrollView *scrollView_; /** * 显示顶部窗口 */ + (void)show { dispat ...