LNMP+Discuz_X3.2伪静态

|
|

最新更新:http://www.linuxea.com/1528.html Centos7部署LNMP+Discuz_X3.2_SC_UTF8
更新内容: 采用更新更稳定的nmp,更加详细的步骤!
|
|

搭建论坛
1,授权库和数据库
2,授权用户
数据库授权
创建表

mysql> create database bbs;

授权

mysql> GRANT ALL ON bbs.* to 'bbs'@'10.0.0.53' IDENTIFIED BY 'password.com';

也可以最小化授权
可以创建删除修改查看:

GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON bbs.* to 'bbs'@'10.0.0.53' IDENTIFIED BY 'password.com';

删除安装完的权限:

DROP user 'bbs'@'10.0.0.53';

重新授权,不给创建表权限 : GRANT SELECT,INSERT,UPDATE,DELETE,DROP ON bbs.* to 'bbs'@'10.0.0.53' IDENTIFIED BY 'password.com';

3,安装配置虚拟主机vhost
下载安装包:

wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip

解压:

mv Discuz_X3.2_SC_UTF8.zip /www/bbs
unzip Discuz_X3.2_SC_UTF8.zip
rm -rf readme
rm -rf utility/
mv upload/* ./

修改属性

chown -R nginx.nginx /www/bbs/
chown -R nginx.nginx config/ data/ uc_*

打开nginx vhost文件

include /etc/nginx/conf.d/blog.conf;

vhost配置文件

server {
        listen          80;
        server_name www.linuxea123.com;
       root  /www/bbs;
        location / {
         index index.php index.html index.htm;
    }
    location ~ .*\.(php|php5.3)?$ {
    root  /www/bbs;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi.conf;
    }
    access_log logs/access_blog.log main;
    }

图片路径,这里的图片路径是可以挂在nfs上面!
/data/attachment/forum

根据提示删除安装目录
rm -rf install/

设置伪静态

vim /etc/nginx/conf.d/blog.conf
    server {
            listen          80;
            server_name www.linuxea123.com;
           root  /www/bbs;
            location / {
             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/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.3)?$ {
        root  /www/bbs;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            include fastcgi.conf;
        }
        access_log logs/access_blog.log main;
        }

3 分享

您可以选择一种方式赞助本站

支付宝扫码赞助

支付宝扫码赞助

日期: 2016-01-17分类: Nginx

标签: nginx

发表评论

已有 7 条评论

加载中,请稍候...
  1. 为你而纯在
    February 18th, 2016 at 10:18 pm

    误删了\"/usr/local/nginx/logs/nginx_log/nginx_error.log\"怎么破

    1. _老白兔
      February 18th, 2016 at 10:39 pm

      重新加载即可!

  2. 为你而纯在
    February 18th, 2016 at 10:56 pm

    想请问下,设置了伪静态之后,为什么点进模块会出现404,然后我取消了发现就没事

    1. 为你而纯在
      February 18th, 2016 at 10:58 pm

      我看不懂伪静态那里那个代码的那张图片,是还要修改那个吗?

      1. _老白兔
        February 18th, 2016 at 11:02 pm

        你需要 rewrite代码添加到配置文件中,这段代码在你的后台,全局模式--》seo设置--》url静态化里面,复制到配置文件段中即可

    2. _老白兔
      February 18th, 2016 at 11:03 pm

      出现404,说明你写的有问题

      1. _老白兔
        February 18th, 2016 at 11:55 pm

        加群 47739260