Giter VIP home page Giter VIP logo

nginx-tutorials's Introduction

This repository holds the source scripts for my Nginx tutorial series published here:

http://openresty.org/download/agentzh-nginx-tutorials-en.html

Versions in other languages are expected to be maintained by the community.

Pre-generated e-books can be downloaded directly from here:

http://openresty.org/#eBooks

How to generate HTML and other ebook format files on your side:

  1. install perl 5.8.1+ into your system (usually it is already installed on *NIX systems.

  2. install the Perl CPAN module List::MoreUtils with the command:

     sudo cpan List::MoreUtils
    
  3. Install Calibre from here: http://calibre-ebook.com/

  4. Build the ebook files *.mobi and *.epub make Note that Gnu make is also required. On most *BSD systems, it's usually required to run "gmake" instead of "make" here.

nginx-tutorials's People

Contributors

agentzh avatar danielstaleiny avatar devmyc avatar imba-tjd avatar kaiwangchen avatar kaiwu avatar kindy avatar maximesong avatar robbyt avatar studdugie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nginx-tutorials's Issues

$tag 变量在“父请求” /main 中⾸先被读取, $tag取值为什么还是2,不是1?

其实道理很简单,因为我们的 C<$tag> 变量在“子请求” C</sub> 中
首先被读取,于是在那里计算出了值 C<2>(因
为 L<ngx_core/$uri> 在那里取值 C</sub>,而根据 L<ngx_map/map>
映射规则,C<$tag> 应当取值 C<2>),从此就被 C<$tag> 的值容
器给缓存住了。而 L<ngx_auth_request/auth_request>
发起的“子请求”又是与“父请求”共享一套变量的,于是当 Nginx 的执行
流回到“父请求”输出 C<$tag> 变量的值时,Nginx 就直接返回缓存住的
结果 C<2>

server {
	location /sub {
		echo "sub tag: $tag"; # 值容器被缓存也应该得到1
	}
	
	location /main {
		echo "main uri: $uri";
		echo "main tag: $tag";  # “父请求” 中⾸先被读取,根据map规则得到1
		auth_request /sub;
		echo "main tag: $tag";  # 值容器被缓存也应该得到1
	}
}

map $uri $tag {
	default 0;
	/main 1;
	/sub 2;
}

docker openresty/openresty:1.17.8.2-1-centos中测试得:

#  curl 'http://localhost/main'
main uri: /main
main tag: 2
main tag: 2

求中文教程继续更新。

求中文教程继续更新。
你的文档很好啊,看完能学到很多东西,为什么没有继续更新了呢?

dtrace: failed to initialize dtrace: DTrace device not available on system

agentzh,您好!最近看您的教程学习Nginx,在看Nginx 配置指令的执行顺序(四),对于使用dtrace工具测试demo的性能时候出现了小问题,今天花了很多时间找资料都没有解决,所以想请教您一下。
首先我的环境是:Ubuntu 14.04.2 LTS,3.16.0-37-generic,X86_64.接着,我按照dtrace4linux安装了dtrace。再着我按照您的教程,将代码敲打进去,因为环境不同,我修改了第一行代码:#!/usr/sbin/dtrace -s.最后运行的时候出现的问题如下:

dtrace: failed to initialize dtrace: DTrace device not available on system.

我想是dtrace安装的问题,所以写了一个简单的测试用例:

#!/usr/sbin/dtrace -s
BEGIN
{
    trace("hello");
    exit(0);
}

测试是可以通过,但是当我运行dtrace -l命令仍旧会出现上述问题。后面我尝试使用一些'dtrace -n'的命令但是仍旧出现同样的问题。最后在网上看到一些solution,但是哪些都是针对非ubuntu系统的,也看到ubuntu上的一个,但是目前没有解决方案。所以冒昧的打扰您!

求中文教程继续更新

文档质量很高,看完能学到很多东西,为什么没有继续更新了呢?我也想从事lua和openresty,并成为contributor

变量作用域的问题

新版的nginx变量是有作用域的?

xxx@debian:~/opt/openresty/nginx/conf$ ../sbin/nginx -V
nginx version: openresty/1.7.10.2

xxx@debian:/opt/openresty/nginx/conf$ curl http://localhost/foo
foo = []
xxx@debian:
/opt/openresty/nginx/conf$ curl http://localhost/bar
foo = [32]

Nginx 变量一旦创建,其变量名的可见范围就是整个 Nginx 配置,甚至可以跨越不同虚拟主机的 server 配置块。我们来看一个例子:
    server {
        listen 8080;

        location /foo {
            echo "foo = [$foo]";
        }

        location /bar {
            set $foo 32;
            echo "foo = [$foo]";
        }
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.