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. Linux sz rz

    借助XShell,使用linux命令 root 账号登陆: su root 1.编译安装 wget http://www.ohse.de/uwe/releases/lrzsz-0.12.20.tar. ...

  2. 百度地图API地址转换成经纬度

    public class LngAndLatUtil { public static Map<String,Double> getLngAndLat(String address){ Ma ...

  3. maven mirror

    国内连接maven官方的仓库更新依赖库,网速一般很慢,收集一些国内快速的maven仓库镜像以备用. ====================国内OSChina提供的镜像,非常不错=========== ...

  4. 挖潜无极限———数据挖掘技术与应用热点扫描[ZZ]

    “我们把世界看成数学,并且把你也看成数学”——用这句话来说明数据挖掘技术的复合性和应用的广泛性似乎再好不过.如今,虽然一些行业在应用这一技术上仍然缺乏足够的主动,但一个不能阻挡的趋势是:已经有越来越多 ...

  5. 装了SVN,你的关联图标变了没有?

    装了SVN,你的关联图标变了没有? 开始合作之后,装上了SVN,非常高效,我在VS写了一部分的代码,上传之后,别人通过下载或是更新,就更新到了合作同伴的VS里,相当于大家在一个VS里写代码.和保强他们 ...

  6. Ajax基础--JavaScript实现

    ajax原理 1.ajax 即“Asynchronous JavaScript and XML”(异步 JavaScript 和 XML),也就是无刷新数据读取. 通俗地讲就是:AJAX 通过在后台与 ...

  7. MySQL Procedure(MySQL存储过程)[转]

    ------Creating Stored Procedures in MySQL------ --Make sure you have version 5 of MySQL:   SELECT VE ...

  8. Python自动化运维之24、JQuery

    jQuery是一个兼容多浏览器的javascript库,核心理念是write less,do more(写得更少,做得更多).它是轻量级的js库 ,它兼容CSS3,还兼容各种浏览器(IE 6.0+, ...

  9. [r]Seven habits of effective text editing

    Seven habits of effective text editing(via) Bram Moolenaar November 2000 If you spend a lot of time ...

  10. Yeoman:适合现代Web应用的现代工作流

    Yeoman:适合现代Web应用的现代工作流   Yeoman是Google的团队和外部贡献者团队合作开发的,他的目标是通过Grunt(一个用于开发任务自动化的命令行工具)和Bower(一个HTML. ...