最完美ThinkPHP Nginx 配置文件
一个配置文件,完美支持普通,兼容,pathinfo,rewrite4种url模式,别怪我没提醒你收藏哦. 常见的静态文件404时也不会再去跑一遍fastcgi浪费资源。
server {
listen ;
server_name localhost;
root /var/www;
index index.html index.htm index.php; error_page /.html;
location = /.html {
return 'Sorry, File not Found!';
} error_page /50x.html;
location = /50x.html {
root /usr/share/nginx/html; # windows用户替换这个目录
} location / {
try_files $uri @rewrite;
} location @rewrite {
set $static ;
if ($uri ~ \.(css|js|jpg|jpeg|png|gif|ico|woff|eot|svg|css\.map|min\.map)$) {
set $static ;
}
if ($static = ) {
rewrite ^/(.*)$ /index.php?s=/$;
}
} location ~ /Uploads/.*\.php$ {
deny all;
} location ~ \.php/ {
if ($request_uri ~ ^(.+\.php)(/.+?)($|\?)) { }
fastcgi_pass 127.0.0.1:;
include fastcgi_params;
fastcgi_param SCRIPT_NAME $;
fastcgi_param PATH_INFO $;
fastcgi_param SCRIPT_FILENAME $document_root$;
} location ~ \.php$ {
fastcgi_pass 127.0.0.1:;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
} location ~ /\.ht {
deny all;
}
}
最完美ThinkPHP Nginx 配置文件的更多相关文章
- thinkphp nginx php-fpm url rewrite 导致 404 错误
## thinkphp nginx php-fpm url rewrite 导致 404 错误 之前thinkphp的系统部署在apache上,考虑到在并发性能nginx比apache强悍得多,所以在 ...
- 通过nginx配置文件抵御攻击
通过nginx配置文件抵御攻击 囧思九千 · 2013/11/12 12:22 0x00 前言 大家好,我们是OpenCDN团队的Twwy.这次我们来讲讲如何通过简单的配置文件来实现nginx防御攻击 ...
- centos 7下配置mysql+php(ThinkPHP)+nginx
最近在Linux平台上配置服务器部署网站(说多了都是泪!),记个笔记! 一.首先是在centos下安装mysql (参考博客) mysql yum库提供了一个简单的和方便的方法来安装和更新MySQL相 ...
- Nginx配置文件nginx.conf中文详解(转)
######Nginx配置文件nginx.conf中文详解##### #定义Nginx运行的用户和用户组 user www www; #nginx进程数,建议设置为等于CPU总核心数. worker_ ...
- 查看nginx配置文件路径
进入nginx安装目录(我的是/usr/local/nginx-1.7.8/) 进入sbin目录,输入 ./nginx -t查看nginx配置文件路径以及该文件语法是否正确 ./nginx -v查看n ...
- Nginx配置文件详解
Nginx是一款面向性能设计的HTTP服务器,相较于Apache.lighttpd具有占有内存少,稳定性高等优势. ######Nginx配置文件nginx.conf中文详解##### #定义Ngin ...
- 005.nginx配置文件
1.替换nginx主配置文件 通过前面的配置,LNMP的环境已经搭建完成,现在我们替换nginx配置文件: [root@huh ~]# cd /usr/local/nginx/conf/[root@h ...
- nginx配置文件nginx.conf超详细讲解
#nginx进程,一般设置为和cpu核数一样worker_processes 4; #错误日志存放目录 error_log /data1/logs/er ...
- ThinkPHP公共配置文件与各自项目中配置文件组合的方法
ThinkPHP公共配置文件与各自项目中配置文件组合的方法 文章TAG:thinkphp 公共配置文件 时间:2014-11-25来源:www.aspku.com 作者:源码库 文章热度: 146 ℃ ...
随机推荐
- openstack共享组件--memcache缓存(2)
一.缓存系统 一.静态web页面: 1.在静态Web程序中,客户端使用Web浏览器(IE.FireFox等)经过网络(Network)连接到服务器上,使用HTTP协议发起一个请求(Request),告 ...
- java.lang.Double[] 转 double[]
Double[] v = list.stream().map(item -> item.getRespTime()).toArray(Double[]::new); Mean mean = ne ...
- 重启 hdfs and yarn datanode
1- start-all.sh and stop-all.sh: Used to start and stop hadoop daemons all at once. Issuing it on th ...
- java中instanceof的基本使用
java中的instanceof运算符是用于判断对象是否是指定类或这个指定类的子类的一个实例,返回值是布尔类型. 语法: boolean result = object instanceof clas ...
- C# while循环及for循环,for循环的嵌套,冒泡循环
循环四要素:初始条件.循环条件.循环体.状态改变 初始条件:开始进入循环 所需要的 第一次条件 循环条件:执行循环所需要满足的条件 循环体:每次循环要执行的代码 状态改变:执行完当前循环体后 循环条件 ...
- 【Python】【基础知识】【内置函数】【help的使用方法】
原英文帮助文档: help([object]) Invoke the built-in help system. (This function is intended for interactive ...
- 接口自动化框架 - httprunner
自己曾经写过一个接口自动化的框架,并做了一版本的优化,一直觉得做的还不错,且没依赖现有的框架. 最近因为一些工作的原因,开始又思考之前写的框架的一些缺点及如何优化,所以找到比较有名的httprunne ...
- CVE-2018-19824漏洞学习
简介 在Linux内核4.19.6之前,本地用户可以通过在Sound / USB /card.c.的usb_audio_probe中错误处理一个恶意USB声音设备(没有接口)来利用ALSA驱动程序中的 ...
- node工具之nodemon
nodemon nodemon是一种工具,可以自动检测到目录中的文件更改时通过重新启动应用程序来调试基于node.js的应用程序. 安装 npm install -g nodemon //或 npm ...
- FastDFS集群部署(转载 写的比较好)
FastDFS集群部署 之前介绍过关于FastDFS单机部署,详见博文:FastDFS+Nginx(单点部署)事例 下面来玩下FastDFS集群部署,实现高可用(HA) 服务器规划: 跟踪服务器1 ...