惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
PCI Perspectives
PCI Perspectives
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V2EX - 技术
V2EX - 技术
Google DeepMind News
Google DeepMind News
量子位
博客园_首页
S
SegmentFault 最新的问题
S
Secure Thoughts
F
Full Disclosure
H
Hacker News: Front Page
博客园 - 三生石上(FineUI控件)
U
Unit 42
H
Heimdal Security Blog
N
News and Events Feed by Topic
A
About on SuperTechFans
C
CERT Recently Published Vulnerability Notes
Cyberwarzone
Cyberwarzone
Help Net Security
Help Net Security
The Hacker News
The Hacker News
L
LINUX DO - 最新话题
Application and Cybersecurity Blog
Application and Cybersecurity Blog
罗磊的独立博客
N
News | PayPal Newsroom
Spread Privacy
Spread Privacy
C
Cisco Blogs
C
CXSECURITY Database RSS Feed - CXSecurity.com
云风的 BLOG
云风的 BLOG
A
Arctic Wolf
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Simon Willison's Weblog
Simon Willison's Weblog
B
Blog
人人都是产品经理
人人都是产品经理
TaoSecurity Blog
TaoSecurity Blog
博客园 - 【当耐特】
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Proofpoint News Feed
Hugging Face - Blog
Hugging Face - Blog
I
InfoQ
D
DataBreaches.Net
大猫的无限游戏
大猫的无限游戏
Apple Machine Learning Research
Apple Machine Learning Research
L
LINUX DO - 热门话题
Google Online Security Blog
Google Online Security Blog
V
Visual Studio Blog
V
Vulnerabilities – Threatpost
Know Your Adversary
Know Your Adversary
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
B
Blog RSS Feed

博客园 - Lil-K

VM-16-pro 安装Centos Stream 9 spring-cloud-alibaba-整合spring-cloud-gateway-3.1.4 基于CentOS7.x安装Nginx-1.18.0 Nginx在Windows下的基本介绍安装以及基本使用 window7下 cmd命令行 Mysql导出表结构 + 表数据 【一】Spark基础 【二】Spark 核心 【八】将日志写入log(glog) - Lil-K - 博客园 【七】ab压测 【六】tf和cgi进行联合试验,完成日志服务器 - Lil-K - 博客园 【四】搭建Nginx服务器 - Lil-K - 博客园 【三】多语言互通 - Lil-K - 博客园 【二】调通单机版的thrift-C++版本 - Lil-K - 博客园 【一】调通单机版的thrift-python版本 - Lil-K - 博客园 Spark在实际项目中分配更多资源 - Lil-K - 博客园 Spark实际项目中调节并行度 - Lil-K - 博客园 IDEA中大小写转换快捷键 使用maven下载cdh版本的大数据jar包 【Hive六】Hive调优小结 - Lil-K - 博客园
【五】安装fcig - Lil-K - 博客园
Lil-K · 2018-08-15 · via 博客园 - Lil-K

安装fcig

此步骤是为了让spawn-fcgi能够识别自定义的demo

  • 下载fcgi:wget ftp://ftp.ru.debian.org/gentoo-distfiles/distfiles/fcgi-2.4.1-SNAP-0910052249.tar.gz

  • 解压安装包:tar -xvf fcgi-2.4.1-SNAP-0910052249.tar.gz

  • 修改文件

    1. find . -name fcgio.h
    2. vim ./include/fcgio.h
    3. 在头部添加代码:#include <cstdio>

编译文件

fcgi-2.4.1-SNAP-0910052249目录下执行:./configure

然后顺序执行命令:makemake install

自定义c文件

  • 创建一个.c结尾的文件,代码如下
#include <iostream>
#include <string>

#include <stdio.h>
#include <stdlib.h>
#include <fcgi_stdio.h>

int main() {

    int count = 0;
    while(FCGI_Accept() >= 0) {
        printf("Content-type: text/html\r\n"
                "\r\n"
                ""
                "Hello Badou EveryBody!!!"
                "Request number %d running on host %s "
                "Process ID: %d\n ", ++count, getenv("SERVER_NAME"), getpid());
    }
    return 0;
}
  • 编译c文件,命令:g++ -g -o test test.c -lfcgi,编译之后会产生同名的编译文件

  • 运行编译文件test可能提示找不到lib库,修改ld.so.conf文件,然后执行命令ldconfig命令

    • 修改文件:vim /etc/ld.so.conf
    include ld.so.conf.d/*.conf
    /usr/include/boost/
    /usr/local/lib/
    
    • 执行命令ldconfig
  • 运行编译后的文件,命令:./test
    打印结果

    Hello Badou EveryBody!!!
    Request number 1 running on host (null) Process ID: 36010
    

测试成功后,启动spawn cgi进行代理托管

  • 运行命令:/usr/local/src/nginx/sbin/spawn-fcgi -a 127.0.0.1 -p 8088 -f /test/thrift_test/cgi_demo/test,之后会提示:spawn-fcgi: child spawned successfully: PID: 36213,然后使用命令:netstat -antup | grep 8088查看端口是否被监听