宝塔面板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语句注释掉,如下图:
随机推荐
- chrome inspect 远程调试H5
chrome://inspect/#devices 一个内置于chrome的远程调试指令,满足远程调试的几个必须条件 1,能够访问https://chrome-devtools-frontend.ap ...
- vector.clear()不能用来清零
vector.clear()函数并不会把所有元素清零,笔者就曾经这样幻想过这个函数的作用,然而事实证明并不是. vector有两个参数,一个是size,表示当前vector容器内存储的元素个数,一个是 ...
- SQL实现数据行列转换
前言: 在日常的工作中,使用数据库查看数据是很经常的事,数据库的数据非常多,如果此时的数据设计是一行行的设计话,就会有多行同一个用户的数据,查看起来比较费劲,如果数据较多时,不方便查看,为了更加方便工 ...
- tensorflow训练了10万次,运行完毕,对这个word2vec终于有点感觉了
tensorflow训练了10万次,运行完毕,对这个word2vec终于有点感觉了 感觉它能找到词与词之间的关系,应该可以用来做推荐系统.自动摘要.相关搜索.联想什么的 tensorflow1.1.0 ...
- tensorflow进阶篇-3
#-*- coding:utf-8 -*- #Tensorflow的嵌入Layer import numpy as np import tensorflow as tf sess=tf.Session ...
- Types方法之upperBound-lowerBound-isUnbounded-containsType
1.upperBound(Type t)方法 /** * The "rvalue conversion". * The upper bound of most types is t ...
- WordPress导航菜单函数
导航菜单是每一个WordPress主题必须的元素,如果你要制作一个WordPress主题,那就必须熟悉WordPress导航菜单注册函数 register_nav_menus() 和 导航菜单调用函数 ...
- Global Embedding 理解
1.Attention-based seq2seq e(t,i):求上一时刻的输出和这一时刻编码器的输出的相似度 a(t,i):求这个词在整个文本中占多大的比重,每个时刻都存在着一个值,这个只是求一个 ...
- spring中获取applicationContext(2)
前几天写web项目的时候,用到了spring mvc. 但是又写bean.我要在代码里面生成,而这个bean里面,又有一些属性是通过spring注入的. 所以,只能通过ApplicationConte ...
- jquery ajax abort()方法
如果用户频繁点击ajax请求,除最后一个外都是无效的,趁早结束节省资源.也可能出现更严重的问题,最后一个发送的请求,响应未必是最后一个,有可能造成混乱.用jquery的abort方法,可以中途中止aj ...