openresty Mac

http://wiki.jikexueyuan.com/project/openresty/openresty/install_osx.html

1.brew 安装 openresty


$ brew tap homebrew/nginx
$ brew install homebrew/nginx/openresty

$ brew update
$ brew install pcre openssl

2.配置 openresty nginx 环境

export PATH=${PATH}:/usr/local/Cellar/openresty/1.13.6.2/nginx/sbin/

3.设置conf

mkdir ~/openresty-test ~/openresty-test/logs/ ~/openresty-test/conf/

4.在 conf 目录下创建一个文本文件作为配置文件,命名为 nginx.conf,文件内容如下:

worker_processes  1;        #nginx worker 数量
error_log logs/error.log;   #指定错误日志文件路径
events {
    worker_connections 1024;
}

http {
    server {
        #监听端口,若你的8080端口已经被占用,则需要修改
        listen 8080;
        location / {
            default_type text/html;

            content_by_lua_block {
                ngx.say("HelloWorld")
            }
        }
    }
}
  1. 启动 openresty nginx
cd     openresty-test
nginx  -p `pwd`/ -c conf/nginx.conf

  1. 我们可以查看 nginx 进程是否存在,并通过访问 HTTP 页面查看应答内容。操作提示如下:
ps -ef | grep nginx

curl http://localhost:6699 -I


nginx  -s reload

nginx  -s stop
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容