部署discuz论坛

  1. 1.直接上配置文件--->>>
  2. [root@web01 conf.d]# vim discuz.cheng.com.conf
  3. server {
  4. listen 80;
  5. server_name discuz.cheng.com;
  6. root /code/discuz/upload;
  7. rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
  8. rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
  9. rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
  10. rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
  11. rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
  12. rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
  13. rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
  14. rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;
  15. if (!-e $request_filename) {
  16. return 404;
  17. }
  18. location / {
  19. index index.html index.php;
  20. }
  21. location ~ \.php$ {
  22. fastcgi_pass 127.0.0.1:9000;
  23. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  24. include fastcgi_params;
  25. }
  26. }
  27. 2.检测语法:
  28. [root@web01 conf.d]# nginx -t
  29. 3.根据Nginx配置,初始化环境,然后上传代码
  30. 1.准备站点目录
  31. [root@web01 conf.d]# mkdir /code
  32. 2.上传wordpress代码
  33. [root@web01 conf.d]# cd /code
  34. [root@web01 code]# unzip Discuz_论坛网站代码.zip
  35. 3.统一Nginx PHP的权限 www
  36. [root@web01 code]# groupadd www -g 666
  37. [root@web01 code]# useradd -u666 -g666 www
  38. [root@web01 code]# chown -R www.www /code
  39. 4.修改配置及重启nginx php
  40. [root@web01 code]# sed -i '/^user/c user www;' /etc/nginx/nginx.conf
  41. [root@web01 code]# systemctl restart nginx
  42. [root@web01 code]# sed -i '/^user/c user = www' /etc/php-fpm.d/www.conf
  43. [root@web01 code]# sed -i '/^group/c group = www' /etc/php-fpm.d/www.conf
  44. [root@web01 code]# systemctl restart php-fpm
  45. 5.域名解析至对用的服务器

discuz论坛-实现伪静态 - 图1
discuz论坛-实现伪静态 - 图2
discuz论坛-实现伪静态 - 图3
discuz论坛-实现伪静态 - 图4