您现在的位置是:首页 > cms教程 > Discuz教程Discuz教程
宝塔nginx服务器安装Discuz的步骤方法
涵双2025-06-29Discuz教程已有人查阅
导读需要说明的是,下网上以前一直流传的Rewrite都是有误的。下面的Rewrite中百分号前面多了个转移字符“\”,这在Apache中是需要的,而在Nginx中则是不需要的。
需要说明的是,下网上以前一直流传的Rewrite都是有误的。
下面的Rewrite中百分号前面多了个转移字符“\”,这在Apache中是需要的,而在Nginx中则是不需要的。
Nginx实例代码
下面的Rewrite中百分号前面多了个转移字符“\”,这在Apache中是需要的,而在Nginx中则是不需要的。
rewrite ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /viewthread.php?tid=$1&extra=page\%3D$3&page=$2 last;
正确的应该是
rewrite ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /viewthread.php?tid=$1&extra=page%3D$3&page=$2 last;
这个错误在基本上目前所有使用Nginx作为服务器,并且开启了Rewrite的网站上存在包括Discuz!官方。Nginx实例代码
server {
listen 80;
server_name.yoursite.com yoursite.com;
location /{
index index.html index.htm index.php;
root /www/ .yoursite.com;
rewrite ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)$ $1/archiver/index.php?$2 last;
rewrite ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3 last;
rewrite ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^(.*)/profile-(username|uid)-(.+)\.html$ $1/viewpro.php?$2=$3 last;
rewrite ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3 last;
rewrite ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2 last;
}
location ~\.php$ {
include fastcgi_params;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:8694;
fastcgi_param SCRIPT_FILENAME /www/www.yoursite.com$fastcgi_script_name;
}
location /www.yoursite.com-status {
stub_status on;
access_log off;
}
}
宝塔安装Discuz使用中的配置server
{
listen 80;
server_name.youtsite.com youtsite.com;
index index.php index.html index.htm default.php default.htm default.html;
root /www/root/ .youtsite.com;
#error_page 404/404.html;
error_page 404 /404.html;
error_page 502 /502.html;
include enable-php-56.conf;
include /www/server/panel/vhost/rewrite/ .youtsite.com.conf;
location /{
index index.html index.htm index.php;
root /www/ root/ .youtsite.com;
rewrite ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)$ $1/archiver/index.php?$2 last;
rewrite ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3 last;
rewrite ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^(.*)/profile-(username|uid)-(.+)\.html$ $1/viewpro.php?$2=$3 last;
rewrite ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3 last;
rewrite ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2 last;
}
location ~\.php$ {
include fastcgi_params;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:8694;
fastcgi_param SCRIPT_FILENAME /www/ root/www.youtsite.com$fastcgi_script_name;
}
location/root/www.youtsite.com-status {
stub_status on;
access_log off;
}
access_log /www/logs/www.youtsite.com.log;
}
本文标签:
很赞哦! ()
上一篇:Discuz目录结构说明
相关教程
- Nginx+LVS+Tomcat+MGR+Nexus+NFS配置shopxo
- lamp+nginx代理discuz+wordpress+phpmyadmin的方法
- discuz的ecshop的伪静态规则apache+nginx
- OpenWrt+nginx+php安装discuz方法示例
- Nginx常用伪静态规则(rewrite)-Discuz X3.2-WordPress-PHPCMS-EC
- nginx配置phpcmsv9伪静态规则404 Not Found设置方法
- Nginx常用Rewrite(伪静态规则)WordPress/PHPCMS/ECSHOP/ShopEX/S
- linux centos8安装php+nginx+mysql运行phpcms网站的方法步骤
- 易优cms在nginx url伪静态报错的解决方法
- windows系统配置nginx环境运行pbootcms首页404的解决方法
- CentOS8+Nginx安装部署WordPress的步骤方法
- mariadb和nginx搭建wordpress的方法
图文教程
Discuz!NT中的数据库链接类介绍
在7月份中我曾经写过一篇随笔叫,叫" .NET2.0 框架中的 AbstractFactory 模式 " 。里面主要说了在2.0框架下的数据库链接工厂中新增的几个类,而这几个类采用的就是抽象类工厂模式
discuz全局变量$_G参数说明介绍
$_G全局变量详解,变量定义路径:soucre/class/discuz/discuz_application.php(1) 全局变量系统篇(2) 全局后台各项设置篇(3)全局当前登录者信息篇
discuz个人空间主题列表图片模式实现方法代码实例
discuz X3空间主题列表 图片展现模式,discuz实现个人空间主题列表调用图片模式,discuz home图片列表如果需要实现该呈现方式,我们需要首先了解discuz封面图片存储原理:
discuz帖子模块用到的表及自动发帖函数介绍
最近在做一个discuz的插件,由于需要程序自动生成并调用discuz已经存在插件的帖子。然而这就相当于自动发帖的功能了。网上找了一下,大部分都是通过curl模拟登陆,模拟发帖的
相关源码
-
(自适应)APP应用软件落地页单页推广页网站模板下载基于PbootCMS内核开发的响应式单页模板,为企业产品展示、服务推广等应用场景设计。通过简洁直观的视觉布局与高效的技术架构,帮助用户快速构建专业级落地页面,实现移动端与PC端数据实时同步展示。查看源码 -
响应式艺考培训学校机构pbootcms模板html5源码基于PbootCMS免费开源内核开发,为艺考培训学校与艺术机构设计,替换图文即可快速适配全行业需求。响应式布局兼容手机/PC端,数据实时同步,运维效率提升300%。查看源码 -
(自适应响应式)双语LED照明灯饰灯具外贸网站pbootcms源码下载模板采用响应式设计,能自动适应手机、平板和电脑等多种设备屏幕,确保用户在不同设备上都能获得良好的浏览体验。同一后台管理,数据实时同步,操作简便高效。查看源码 -
自适应LED照明外贸灯具灯泡灯具英文网站模板该外贸灯具网站模板专为LED照明、灯具出口企业定制,采用PbootCMS内核开发,提供高效建站方案。通过响应式设计和SEO优化能力,帮助企业低成本构建专业外贸展示平台。查看源码 -
WordPress个人博客主题 - wp-Concise-v1.0免费下载wp-Concise-v1.0是一款专为个人博客设计的简约风格主题,采用全宽排版设计理念,注重内容呈现效果。该模板适用于个人随笔、技术分享、生活记录等博客场景,帮助用户打造专业的内容展示空间。查看源码 -
(自适应)居家生活日用品纸盘纸盒纸杯卫生纸巾生产厂家pbootcms模板为纸品生产企业打造的现代化展示平台,自动适应各种设备屏幕,确保浏览体验一致,完善的SEO功能,提升网站曝光度,基于PbootCMS构建,源码开放可定制。查看源码
| 分享笔记 (共有 篇笔记) |
