在Ubuntu18下安装openresty/Nginx并配置skywalking、FastDFS

在Ubuntu18下安装openresty/Nginx并配置skywalking、FastDFS
1、安装操作系统必须包

# 这里的包是 在编译openresty时缺少的,如果安装发现又其他未找到的包,自行安装就是
apt-get install tofrodos dos2unix mercurial

下载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

当前我们需要集成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

修改fastDFS配置文件http.conf

http.anti_steal.check_token = true

修改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

修改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;
        }
        ……
    }
}

到这里我们就修改好所有配置了,启动openresty,大功告成。

/usr/local/openresty/bin/openresty
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值