https://blog.csdn.net/testunit/article/details/109471713
https://blog.csdn.net/testunit/article/details/109471713
在Ubuntu18下安装openresty/Nginx并配置skywalking、FastDFS
在Ubuntu18下安装openresty/Nginx并配置skywalking、FastDFS
1、安装操作系统必须包
# 这里的包是 在编译openresty时缺少的,如果安装发现又其他未找到的包,自行安装就是
apt-get install tofrodos dos2unix mercurial
- 1
- 2
下载openresty源码
git clone https://github.com/openresty/openresty.git
cd openresty/
git tags
git checkout v1.17.8.2
make -j2
cd openresty-1.17.8.2
./configure -j2
make && make install
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
当前我们需要集成skywalking及 fastDFS,需要下载fastdfs-nginx-module、skywalking-nginx-lua
cd /usr/local/src
git clone https://github.com/HankDevelop/fastdfs-nginx-module.git
cd fastdfs-nginx-module
# 该分支支持 分组配置 token校验
git checkout dev_V1.22
cd ../
git clone https://github.com/apache/skywalking-nginx-lua.git
cd skywalking-nginx-lua
git checkout v0.3.0
cd /usr/local/src/openresty/openresty-1.17.8.2
./configure --add-module=/usr/local/src/fastdfs-nginx-module/src
make && make install
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
修改fastDFS配置文件http.conf
http.anti_steal.check_token = true
- 1
修改fastDFS配置文件/etc/fdfs/mod_fastdfs.conf(从fastdfs-nginx-module/src目录下拷贝)
# 当前存储中分组数量
group_count = 2
# group settings for group #1
# since v1.14
# when support multi-group on this storage server, uncomment following section
[group1]
group_name=group1
# 新添加参数
check_token=false
storage_server_port=23000
store_path_count=1
store_path0=/data/fastdfs/group1
# group settings for group #2
# since v1.14
# when support multi-group, uncomment following section as neccessary
[group2]
group_name=group2
check_token=true
storage_server_port=23001
store_path_count=1
store_path0=/data/fastdfs/group2
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
修改nginx.conf,添加skywalking配置、fastDFS访问配置
http{
……
lua_package_path "/usr/local/src/skywalking-nginx-lua/lib/?.lua;;";
# Buffer represents the register inform and the queue of the finished segment
lua_shared_dict tracing_buffer 100m;
# Init is the timer setter and keeper
# Setup an infinite loop timer to do register and trace report.
init_worker_by_lua_block {
local metadata_buffer = ngx.shared.tracing_buffer
-- Set service name
metadata_buffer:set('serviceName', 'fastDFSProxy')
-- Instance means the number of Nginx deployment, does not mean the worker instances
metadata_buffer:set('serviceInstanceName', 'fastDFSProxy-storage1')
# 10.39.37.54 为skywalking 安装地址
require("skywalking.client"):startBackendTimer("http://192.168.12.54:12800")
}
……
server{
……
location ~/group1/M00 {
ngx_fastdfs_module;
}
location ~/group2/M00 {
ngx_fastdfs_module;
}
……
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
到这里我们就修改好所有配置了,启动openresty,大功告成。
/usr/local/openresty/bin/openresty
posted on 2021-02-24 17:28 luzhouxiaoshuai 阅读(279) 评论(0) 编辑 收藏 举报