server{
listen ;
server_name a.com;
index index.php;
root /usr/share/nginx/html;
location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$ last;
break;
}
} location ~ \.php {
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
include ./conf.d/fcgi.conf;
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $;
set $path_info $;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
}
   location ~* .(jpg|gif|png|js|css)$ {
if (-f $request_filename) {
expires 30d;
break;
}
}

nginx 忽略大小写安装nginx lua模块

手动编译nginx,安装lua-nginx-module步骤

1,环境支持

apt-get install libreadline-dev libncurses5-dev libpcre3-dev \
libssl-dev perl make build-essential apt-get install postgresql-9.3 postgresql-server-dev-9.3

2,下载openresty

sudo wget https://openresty.org/download/openresty-1.11.2.2.tar.gz

3,编译

sudo ./configure --prefix=/usr/local/openresty \
--with-luajit \
--without-http_redis2_module \
--with-http_iconv_module \
--with-http_postgres_module

4,配置nginx访问路径

sudo ln -s /usr/local/openresty/nginx/sbin/nginx /usr/local/sbin/nginx

5,启动 sudo nginx

结束.

Nginx简单防盗链

静态文件匹配处改为如下
location ~ .*\.(jpg|jpeg|JPG|png|gif|icon)$ {
valid_referers blocked www.qixing318.com qixing318.com;
if ($invalid_referer) {
return ;
}
}

Nginx禁止访问目录

location ~* \.(txt|doc)${
root /data/www/wwwroot/linuxtone/test;
deny all;
}

Nginx设置缓存

proxy_cache_path /path/to/cache levels=: keys_zone=my_cache:10m max_size=10g inactive=60m
use_temp_path=off;
server {
...
location / {
proxy_cache my_cache;
proxy_cache_revalidate on;
proxy_cache_min_uses ;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_lock on;
proxy_pass http://my_upstream;
}
}
详细文档讲解
https://moonbingbing.gitbooks.io/openresty-best-practices/content/ngx/static_file.html

参考文档:

http://openresty.org/cn/installation.html

https://moonbingbing.gitbooks.io/openresty-best-practices/content/ngx/nginx_local_pcre.html

openresty安装lua和nginx相关的更多相关文章

  1. 通过lua进行nginx的权限控制

    nginx_lua的安装 nginx使用luajit进行编译安装 使用openresty进行yum安装 openresty中将lua和nginx进行封装,详情可查看openresty官网 openre ...

  2. OpenResty / Nginx模块,Lua库和相关资源的列表

    OpenResty / Nginx模块,Lua库和相关资源的列表 什么是OpenResty OpenResty是一个成熟的网络平台,它集成了标准的Nginx核心,LuaJIT,许多精心编写的Lua库, ...

  3. 给lnmp一键包中的nginx安装openresty的lua扩展

    lnmp一键包(https://lnmp.org)本人在使用之后发现确实好用,能帮助我们快速搭建起lnmp.lamp和lnmpa的web生产环境,因此推荐大家可以多试试.但有的朋友可能需要使用open ...

  4. Openresty安装及使用配置(OPENRESTY+NGINX)

    Openresty 简介 Openresty是一个基于NGINX和Lua的高性能Web平台,内部有大量的Lua库和第三方模块,能够很方便的搭建处理高并发,扩展性高的Web平台和动态网关,充分利用 Ng ...

  5. 安装lua和openresty

    #### ubuntu 16.04 64bit 安装Lua luajit 及openresty 1 安装lua ,因为luajit 支持lua5.1较好.貌似不支持5.2和5.3作为学习,我就安装5. ...

  6. Nginx安装lua支持

    Nginx安装lua支持 需要LuaJIT-2.0.4.tar.gz,ngx_devel_kit,lua-nginx-module 1.下载安装LuaJIT-2.0.4.tar.gz wget -c ...

  7. OpenResty:通过 Lua 扩展 NGINX 实现的可伸缩的 Web 平台

    关于 http://openresty.org/cn/about.html 这个开源 Web 平台主要由章亦春(agentzh)维护.在 2011 年之前曾由淘宝网赞助,在后来的 2012 ~ 201 ...

  8. OpenResty入门之使用Lua扩展Nginx

    记住一点:nginx配置文件很多坑来源自你的空格少了或多了. 1.Centos下载安装 如果你的系统是 Centos 或 RedHat 可以使用以下命令: yum install readline-d ...

  9. nginx安装lua模块实现高并发

    nginx安装lua扩展模块 1.下载安装LuaJIT-2.0.4.tar.gz wget -c http://luajit.org/download/LuaJIT-2.0.4.tar.gz tar ...

随机推荐

  1. IOI1994 北京2008的挂钟 迭代加深

    总的来讲,这是一道很⑨的题,因为: (1)题目中有⑨个挂钟 (2)有⑨种操作方案 (3)这题因为解空间太小所以可以直接⑨重循环!! 这题可以用迭代加深搜索高效求解,剪枝的策略也很显然: >所求的 ...

  2. asp.net尽量不在js里写<%%>

    asp.net尽量不在js里写<%%> eg: <script type="text/javascript"> var rootsid="&quo ...

  3. java dos下中文乱码

    代码如下: public class PrintString{ public static void main(String args[]){ System.out.println("\\* ...

  4. javascript DOM艺术

    一.DOM基础1.节点(node)层次Document--最顶层的节点,所有的其他节点都是附属于它的.DocumentType--DTD引用(使用<!DOCTYPE>语法)的对象表现形式, ...

  5. cocod2d-x 之 CCDirector、CCScene、CCSprite

    CCDirector是控制游戏流程的主要组件. typedef enum { /// sets a 2D projection (orthogonal projection)2D投机模式 kCCDir ...

  6. java高精度数组

    POJ1205 递推公式为a[i] = 3*a[i-1] - a[i-2], a[1] = 1,a[2] = 3 , i 最高为100; 搞懂了使用BigInteger开数组. import java ...

  7. 枚举宏(Adopting Modern Objective-C)

    使用NS_ENUM 和 NS_OPTIONS宏定义枚举.Adopting Modern Objective-C 使用NS_ENUM宏定义一组互斥的枚举值: typedef NS_ENUM(NSInte ...

  8. c#xml序列化对象,xml标记都缩写了

    最近最后一个接口,他们的格式很严格必须是如下格式 <message> <age>20</age> <name>张三</name> </ ...

  9. Laravel框架——增删改查

    增: //save返回true false $res = new member(); res->username = 'a'; $res->password = 'b'; dd($res- ...

  10. operation 多线程

    2.Cocoa Operation 优点:不需要关心线程管理,数据同步的事情.Cocoa Operation 相关的类是 NSOperation ,NSOperationQueue.NSOperati ...