微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何创建并配置nginx

本篇内容介绍了“如何创建并配置Nginx”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

Nginx

创建Nginx docker

docker run -d --name Nginx  -p 80:80 -v $PWD/log/Nginx:/var/log/Nginx Nginx

在当前目录创建 vim ./etc/fluent.conf 配置文件

<source>  @type tail  path  /var/log/Nginx/access.log  pos_file /tmp/Nginx.access.pos  tag Nginx.access.log  <parse>    @type Nginx  </parse></source><match Nginx.access.log>  @type copy  <store>    @type stdout  </store></match>

启动fluentd

docker run -d --name fluentd  -v $(pwd)/etc:/fluentd/etc -v $(pwd)/log:/var/log fluent/fluentd

读取到的信息如下

2020-08-10 17:39:20.000000000 +0000 Nginx.access.log: {"remote":"172.17.0.1","host":"-","user":"-","method":"GET","path":"/","code":"200","size":"612","referer":"-","agent":"curl/7.54.0","http_x_forwarded_for":"-"}

“如何创建并配置Nginx”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注编程之家网站,小编将为大家输出更多高质量的实用文章

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐