编程技术分享平台

网站首页 > 技术教程 正文

Nginx设置访问服务器某个目录(steam无法访问服务器,请检查您的网络连接并单击重试)

xnh888 2024-09-19 06:12:07 技术教程 37 ℃ 0 评论

最近实时的项目有个需求,就是要查看集群中各个节点下面跑的项目的Log。于是想到了用Nginx将log目录暴露出来集成到现有的监控平台中去。
nginx的安装配置在前面的博客中有提到过,这里记录下如何配置访问log目录。

1 首先,设置权限

配置需要访问的log目录有权限

chmod -R /.../...

在nginx.conf文件中,添加或覆盖下面一行

user root;

2 配置server节点

server {
listen 64001;
server_name beta3.hadoop.feidai.com;

charset utf-8;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root html;
index index.html index.htm;
autoindex on;
}

location /feidai-kafka-kudu/bin/slog {
root /root;
autoindex on;
}

location /feidai-canal-kafka/bin/slog {
root /root;
autoindex on;
}
......

其中添加了两个location节点,配置autoindex on;使其能展示目录。
在location节点里面配置alas会把指定路径当作文件路径,
而配置root会把指定路径拼接到文件路径后,再进行访问。
这里使用root配置。
访问实例:http://beta3.hadoop.feidai.com:64001/feidai-kafka-kudu/bin/slog/
整合到监控平台的效果如下图

Nginx设置访问服务器某个目录 | 《Linux就该这么学》 (linuxprobe.com)

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表