nginx+lua

1.创建nginx工作目录
    use ~/work:
    mkdir ~/work
    cd ~/work
    mkdir logs/ conf/
2.设置PATH
    PATH=/usr/local/openresty/nginx/sbin:$PATH
    export PATH
3.启动
    nginx -p `pwd`/ -c conf/nginx.conf
4.停止
    nginx -p `pwd`/ -s stop
5.设置工程目录
    配置openresty加载lua目录:nginx.conf文件的http模块下加入,如下类似的配置:
    lua_package_path "/opt/openresty/lualib/?.lua;;";  #lua 模块  
    lua_package_cpath "/opt/openresty/lualib/?.so;;";  #c模块 
        
6.在 nginx.conf 文件的 server {.. ...} 中的content_by_lua同级加入 lua_code_cache off; 可以方便调试lua脚本,修改lua脚本之后,不需要 reload nginx.


备注:
nginx -s reload|reopen|stop|quit  #重新加载配置|重启|停止|退出 nginx
nginx -t   #测试配置是否有语法错误

nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives]

-?,-h           : 打开帮助信息
-v              : 显示版本信息并退出
-V              : 显示版本和配置选项信息,然后退出
-t              : 检测配置文件是否有语法错误,然后退出
-q              : 在检测配置文件期间屏蔽非错误信息
-s signal       : 给一个 nginx 主进程发送信号:stop(停止), quit(退出), reopen(重启), reload(重新加载配置文件)
-p prefix       : 设置前缀路径(默认是:/usr/local/Cellar/nginx/1.2.6/)
-c filename     : 设置配置文件(默认是:/usr/local/etc/nginx/nginx.conf)
-g directives   : 设置配置文件外的全局指令

nginx -p `pwd`/ -c conf/nginx.conf(-c conf/nginx.conf: 使用ngnix安装的默认路径/usr/local/openresty/nginx/路径拼接)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值