-
- 安装bbs论坛
0.创建bbs专用数据库及授权用户
create database bbs;
grant all on bbs.* to bbs@’192.168.80.%’ identified by ‘123456’;
flush privileges;
show grants for bbs@’192.168.80.%’;
mysql -ubbs -p123456 -h 192.168.80.101 #远程测试
注意:安装完bbs后重新授权
drop user bbs@’192.168.80.%’;
grant insert,delete,update,select,drop on bbs.* to bbs@’192.168.80.%’ identified by ‘123456’;
flush privileges;
- 配置Nginx
- 配置bbs server
cd /application/nginx/conf/extra/
vi bbs.conf
server {
listen 80;
server_name bbs.etiantian.org;
location / {
root html/bbs;
index index.php index.html index.htm;
}
location ~ .*\.(php|php5)?$ {
root html/bbs;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
access_log logs/access_bbs.log main;
}
- 在Nginx主配置文件添加include
worker_processes 1;
error_log logs/error.log error;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
log_format main ‘$remote_addr – $remote_user [$time_local] “$request” ‘
‘$status $body_bytes_sent “$http_referer” ‘
‘”$http_user_agent” “$http_x_forwarded_for”‘;
#nginx vhosts config
include extra/www.conf;
include extra/bbs.conf;
include extra/blog.conf;
include extra/status.conf;
}
- 配置bbs站点
discuz论坛首页:http://www.discuz.net/forum.php
cd /application/nginx/html/bbs/
wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip
unzip Discuz_X3.2_SC_UTF8.zip
rm -rf readme/ utility/
mv Discuz_X3.2_SC_UTF8.zip /server/tools/
mv ./upload/* .
chown -R root.root ../bbs
chown -R nginx.nginx data config uc_* #此授权目录安装时会显示
- 登录网站创建bbs
rm -rf install #安装完后删除安装程序
注意:用户上传目录将来需要挂载到NFS上
- 为blog程序配置实现URL伪静态
首先在bbs后台启动需要URL静态化的页面,然后查看对应web的rewrite规则,如Nginx的rewrite代码如下,并将其至于bbs server配置文件server中的“location / {” 区域。
rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;
rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last;
if (!-e $request_filename) {
return 404;
}
- 重启Nginx服务即可
- blog、bbs上传目录NFS挂载
mount -t nfs 192.168.80.105:/var/html/bbs/data /var/html/bbs/data
mount -t nfs 192.168.80.105:/var/html/bbs/upload /var/html/bbs/upload
mount -t nfs 192.168.80.105:/var/html/blog/wp-content /var/html/blog/wp-content