快捷菜单
常用功能一站直达
更多功能请点顶栏「快捷菜单」

本内容来自:《极客时间:Nginx 核心知识 150 讲》,版权归原作者所有,这里仅记录自己的学习笔记。
1openresty-1.13.6.2
2nginx1.13.6
3centos7官网下载源码包:
https://openresty.org/download/openresty-1.13.6.2.tar.gz
自己百度云盘:
openresty-1.13.6.2.tar.gz

1#准备下环境(检查系统是否安装了如下包,如果没,直接安装)
2yum install -y gcc-c++ openssl openssl-devel pcre pcre-devel zlib zlib-devel -y #如果你用的是CentOS,那么搭环境非常简单,安装这些包后,make就能准备好nginx编译的基本环境下载源码包:
1cd /root/
2wget https://openresty.org/download/openresty-1.13.6.2.tar.gz
3tar xf openresty-1.13.6.2.tar.gz
4cd openresty-1.13.6.21#在openresty-1.13.6.2目录下执行
2./configure
3make
4make install查看下默认openresty的配置文件在哪里?
1[root@localhost openresty-1.13.6.2]# ./configure --help|more
2--prefix=PATH set the installation prefix (default to /usr/local/openresty)
1[root@localhost ~]# vim /usr/local/openresty/nginx/conf/nginx.conf
2……
3 server_name test.one.cn;
4
5 location /lua {
6 default_type text/html;
7 content_by_lua '
8 ngx.say("User-Agent:",ngx.req.get_headers()["User-Agent"])
9 ';
10 }
11…… 
1[root@localhost openresty]# /usr/local/openresty/nginx/sbin/nginx
2[root@localhost openresty]# ps -ef|grep nginx
3root 18258 1 0 07:56 ? 00:00:00 nginx: master process /usr/local/openresty/nginx/sbin/nginx
4nobody 18259 18258 0 07:56 ? 00:00:00 nginx: worker process
5root 18261 9690 0 07:57 pts/0 00:00:00 grep --color=auto nginx
6[root@localhost openresty]#
7
8#重载nginx:
9/usr/local/openresty/nginx/sbin/nginx -s reload
192.168.1.102 test.one.cn
浏览器输入域名:(可以看到OpenResty界面了,另外通过f12检查可以看到响应头里Server是openresty/1.13.6.2了。)

\lua再次验证正常就可以看到OpenResty返回给我们的数据了。

结束。

bundle目录:
nginx的第三方模块(c语言写的);
lua模块(lua语言写的);
[root@localhost openresty-1.13.6.2]# ./configure --help|more 查看帮助

我的博客主旨:
🍀 个人网站

🍀 微信二维码
x2675263825 (舍得), qq:2675263825。

🍀 微信公众号
《云原生架构师实战》

🍀 csdn
https://blog.csdn.net/weixin_39246554?spm=1010.2135.3001.5421

🍀 知乎
https://www.zhihu.com/people/foryouone

如果你还有疑惑,可以去我的网站查看更多内容或者联系我帮忙查看。
如果你有更好的方式,评论区留言告诉我。谢谢!
好了,本次就到这里了,感谢大家阅读,最后祝大家生活快乐,每天都过的有意义哦,我们下期见!

日历 · 精选 · 友链 · 更多
如果内容对你有帮助,欢迎请我喝杯咖啡 ☕



One的公众号
爱折腾博客的小白