Skip to content

Commit 4b09f07

Browse files
committed
相对路径总结(相对于nginx安装目录)
1 parent 1e25374 commit 4b09f07

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Openresty/lua-common-package/lua-require.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
└── nginx
2121
```
2222
+ [Lua require 相对路径 博客园详解](http://www.cnblogs.com/smallboat/p/5552407.html)
23-
+ 相对路径总结
23+
+ 相对路径总结(相对于nginx安装目录)
2424
+ **当前目录** :`/opt/openresty/nginx/conf/Lua`
2525
+ 注意:如果在当前没有了,以下的代码运行是没有问题的
2626
+ 就是所有的lua脚本代码全部写在Lua文件夹下面去
@@ -70,7 +70,8 @@
7070
```
7171
location /api {
7272
lua_code_cache off;
73-
content_by_lua_file /opt/openresty/nginx/conf/Lua/main.lua;
73+
content_by_lua_file /opt/openresty/nginx/conf/Lua/main.lua; # 绝对路径
74+
#content_by_lua_file conf/Lua/main.lua; # 相对路径(相对于nginx安装目录)
7475
}
7576
```
7677
+ CURL 请求结果

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
+ [Openresty 学习](#Openresty_web_knowledge)
2525
+ [安装](#Openresty_install_knowledge)
2626
+ [默认配置信息](#Openresty_config_knowledge)
27+
+ [Lua require 绝对和相对路径问题(一个文件引入另外一个文件的Function),已经解决](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Openresty/lua-common-package/lua-require.md)
2728
+ [luajit 执行文件默认安装路径](#Openresty_web_knowledge)
2829
+ [lua-resty-redis 扩展](#Openresty_resty-redis)
2930
+ [lua-resty-websocket 扩展](#Openresty_resty-websocket)
@@ -362,7 +363,6 @@
362363
The man name is Tinywan
363364
The man name is Phalcon
364365
```
365-
+ [Lua require 绝对和相对路径问题(一个文件引入另外一个文件的Function),已经解决](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Openresty/lua-common-package/lua-require.md)
366366
#### <a name="Openresty_resty-redis"/> lua-resty-redis 扩展 (是openresty下操作redis的模块)
367367
+ 代码引入:`lua_package_path "/opt/openresty/nginx/lua/lua-resty-redis/lib/?.lua;;";`
368368
+ Lua脚本实现一个CDN的反向代理功能(智能查找CDN节点)(测试成功,可上线)

0 commit comments

Comments
 (0)