宝塔面板nginx配置安装Discuz
Discuz!在Nginx下的Rewrite
需要说明的是,下网上以前一直流传的Rewrite都是有误的。
下面的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 www.yoursite.com yoursite.com;
location /{
index index.html index.htm index.php;
root /www/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 www.youtsite.com youtsite.com;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/www.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/www.youtsite.com.conf;
location /{
index index.html index.htm index.php;
root /www/wwwroot/www.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/wwwroot/www.youtsite.com$fastcgi_script_name;
}
location /wwwroot/www.youtsite.com-status {
stub_status on;
access_log off;
}
access_log /www/wwwlogs/www.youtsite.com.log;
}
本文参考自:圆圆的猿猿
宝塔面板nginx配置安装Discuz的更多相关文章
- OpenWrt+nginx+php安装discuz
下面这个图片是本次的硬件资源:一个无线路由器的开发板,一个8G的u盘,一条手机的数据线(可以作为串口和供电使用),一条网线,一个USB Hub. <ignore_js_op> ...
- 腾讯云服务器安装宝塔面板快速配置LNMP/LAMP网站系统
我们在选择购买腾讯云服务器之后,有部分用户肯定是用来建站用途的.毕竟云服务器的性能和功能比虚拟主机优秀很多.腾讯云服务器拥有香港.北京.广州.上海.美国等多个机房,可以安装Linux和Windows系 ...
- nginx配置安装
先安装pcrepcre作用是让Nginx支持Rewrite功能下载地址:https://sourceforge.net/projects/pcre/files/pcre/,选择最新版本进行下载下载之后 ...
- Nginx配置安装(Mac)
我用到的安装工具是:homebrew 真的很方便! 步骤1: 打开终端,输入 brew info nginx结果:我们可以看到,nginx在本地还未安装(Not installed),nginx的来源 ...
- Linux环境下Nginx配置安装PHP
下边的安装配置方法,我试了一晚上没有成功,可能因为我的系统环境比较复杂,所以建议: 先安装PHP.使用yum命令安装,在安装配置MySQL,具体做法看博客中其他文章,至于Nginx服务器可以安装完这两 ...
- centos7 - nginx配置安装phpmyadmin
原文 https://www.linuxidc.com/Linux/2017-10/147556.htm 使用Nginx搭建phpMyAdmin Nginx有什么用? Nginx可读作Engin ...
- 【宝塔面板】pm2 安装没反应问题
在使用宝塔安装 node环境时候..点击 PM2管理器安装.然后没反应.刷新列表.还是未安装 解决办法: 进入SSH, 查看错误 cat /tmp/panelExec.log 更新git yum up ...
- 宝塔面板php扩展安装
yum install libmcrypt libmcrypt-devel mcrypt mhash wget http://pecl.php.net/get/mcrypt-1.0.1.tgz tar ...
- 宝塔面板1G内存安装mysql5.7提示“至少需要XX兆内存”的解决办法
打开文件:/www/server/panel/class/panelPlugin.py 搜索关键词:“至少” (可能在134行) 然后把这行if语句注释掉,如下图:
随机推荐
- MyBatis Generator XML 配置
使用反向生成器可以生成数据库表对应的实体类和mapper映射文件: 以下是具体介绍相应xml文件的配置: 附上一张配置的模板: <?xml version="1.0" enc ...
- 构建RequestDelegate管道
1. 创建 Context.cs using System; using System.Threading.Tasks; namespace MyPipeline { public class Con ...
- 利用Django做一个简单的分页页面
views代码: from django.shortcuts import render from django.conf import settings from booktest.models i ...
- pymysql模块使用
一.写函数的原因 写这个函数的原因就是为了能够不每次在用Python用数据库的时候还要在写一遍 做个通用函数做保留,也给大家做个小小的分享,函数不是最好的,希望有更好的代码的朋友能提出 互相学习 二 ...
- #阿里云#云服务器部署Django(基础篇)
前言 本人能力有限,本文只是简单介绍基础部署流程,没有过多考虑系统安全等因素,请谅解.初学者参考了解,大神勿喷. 纯测试部署,采用阿里云ECS,系统Ubuntu 16.04 64位,部署采用nginx ...
- 剑指offer二十一之栈的压入、弹出序列
一.题目 输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否为该栈的弹出顺序.假设压入栈的所有数字均不相等.例如序列1,2,3,4,5是某栈的压入顺序,序列4,5,3,2,1是该压栈序 ...
- (转)python函数: 内置函数
原文:https://blog.csdn.net/pipisorry/article/details/44755423 https://juejin.im/post/5ae3ee096fb9a07aa ...
- [webpack]path、publicPath、--content-base 理解
附源码:http://files.cnblogs.com/files/chenshao/startPublic.rar 'use strict'; var webpack = require('web ...
- Android4.0 Launcher 源码分析2——Launcher内容加载绑定详细过程
Launcher在应用启动的时候,需要加载AppWidget,shortcut等内容项,通过调用LauncherModel.startLoader(),开始加载的工作.launcherModel中加载 ...
- android studio 3.1.4下载安装配置(附旧版本下载地址)
windows下安装android studio.当前时间2018年9月. 最新版本的android studio3.2.0-release出来了,拥有许多新的特性 可能我是一个业余的android开 ...