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. 显示scrollbar

    修改CSS overflow的值 overflow: 参考MDN 例子: overflow: auto or scroll

  2. Ubuntu1404+Django1.9+Apache2.4部署配置1安装

    关于Ubuntu环境下的文章很少,搜索一些问题比较麻烦,这里将别人的做法和自己做的整合一下.这篇文章主要讲解基础的安装,至于Django1.9如何部署到Apache2.4请转到下一篇博文http:// ...

  3. 【POJ2752】【KMP】Seek the Name, Seek the Fame

    Description The little cat is so famous, that many couples tramp over hill and dale to Byteland, and ...

  4. ubuntu 解压,压缩

    .rar解压:rar x FileName.rar压缩:rar a FileName.rar DirName

  5. 入门4:PHP 语法基础1

    一.PHP标记符 1.PHP页面中 以<?php  开头, ?>结尾,纯PHP页面结尾可以不写?> 2.在HTML页面插入PHP代码,必须有?>结尾.代码如下: <!DO ...

  6. Ubuntu You don't have permission to access解决方案!

    最近对Linux越来越喜欢了,就直接安装了一个Ubuntu,配制好LAMP后,在做小项目时,出现了下面的问题:Ubuntu You don't have permission to access ** ...

  7. Asp.net MVC分页实例

    分页是网页基本功能,这里主要讨论在Asp.net MVC环境下分页的前端实现,不涉及后台分页.实现效果如下图显示: Step 1.建立分页信息类 public class PagingInfo { p ...

  8. Windows的免費hMailServer搭配SpamAssassin過濾垃圾郵件:安裝與設定

    http://jdev.tw/blog/1677/hmailserver-with-spamassassin-sawin32 為了解決垃圾信泛濫的狀況,這兩天「跨界」測試了運行在Windows上的免費 ...

  9. http头

    http://hi.baidu.com/poplarshine/item/219bbef35f1d1d10d6ff8cf9 http://www.cnblogs.com/meil/archive/20 ...

  10. check sql server edition (version 版本)

    SELECT @@VERSION refer : https://www.mssqltips.com/sqlservertip/1140/how-to-tell-what-sql-server-ver ...