Discuz论坛的搭建【基于LNMP环境搭建成功后】

##创建BBS数据库在本地/远程服务器

mysql -uroot -proot
create database bbs;
show databases;
grant all on bbs.*to bbs@'localhost' identified by 'root';
grant all on bbs.*to bbs@'192.168.25.%' identified by 'root';     # 远程mysql服务器
flush privileges;
select user,host from mysql.user;
##远程连接数据库:
mysql -ubbs -proot -h 192.168.25.138
echo ' 192.168.25.144 www.bbs.com  bbs.com'>> /etc/hosts

Linux 下Discuz论坛的搭建

 

##配置BBS和Nginx
在Nginx服务器下面配置bbs的Vhosts

vim /usr/local/nginx/conf/nginx.conf                  -->添加include
vim /usr/local/nginx/conf/extra/bbs.conf                -->配置域名
vim /etc/hosts                                        -->添加DNS解析
/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx -s reload              -->重启服务
mkdir -p /usr/local/nginx/html/bbs              -->创建虚拟路径
cd /usr/local/nginx/html
chown -R root.root ./bbs
find ./blog/ -type f|xargs chmod 644
find ./blog/ -type d|xargs chmod 755              -->更改权限
server {
        listen       80;
        server_name  www.bbs.com;
        root   html/discuz;
        location / {
#            index  index.html index.htm;
             index  index.php index.html index.htm;
             rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
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/archiver/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;
}
        }
        location ~.*\.(php|php5)?$ {
             fastcgi_pass  127.0.0.1:9000;
             fastcgi_index index.php;
             include  fastcgi.conf;
        }
        access_log logs/access_discuz.log main;
    }
bbs.conf

相关文章:

  • 2021-06-30
  • 2022-01-14
  • 2022-01-07
  • 2021-04-10
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-29
  • 2021-10-09
  • 2022-01-14
  • 2022-01-05
  • 2021-04-26
  • 2021-06-05
  • 2021-10-06
相关资源
相似解决方案