部署discuz论坛
1.直接上配置文件--->>>
[root@web01 conf.d]# vim discuz.cheng.com.conf
server {
listen 80;
server_name discuz.cheng.com;
root /code/discuz/upload;
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;
if (!-e $request_filename) {
return 404;
}
location / {
index index.html index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
2.检测语法:
[root@web01 conf.d]# nginx -t
3.根据Nginx配置,初始化环境,然后上传代码
1.准备站点目录
[root@web01 conf.d]# mkdir /code
2.上传wordpress代码
[root@web01 conf.d]# cd /code
[root@web01 code]# unzip Discuz_论坛网站代码.zip
3.统一Nginx PHP的权限 为 www
[root@web01 code]# groupadd www -g 666
[root@web01 code]# useradd -u666 -g666 www
[root@web01 code]# chown -R www.www /code
4.修改配置及重启nginx php
[root@web01 code]# sed -i '/^user/c user www;' /etc/nginx/nginx.conf
[root@web01 code]# systemctl restart nginx
[root@web01 code]# sed -i '/^user/c user = www' /etc/php-fpm.d/www.conf
[root@web01 code]# sed -i '/^group/c group = www' /etc/php-fpm.d/www.conf
[root@web01 code]# systemctl restart php-fpm
5.域名解析至对用的服务器