一、nginx下载安装
源码下载地址:http://nginx.org/en/download.html
1.下载:$wget http://nginx.org/en/download.html/nginx-1.12.2.tar.gz
2.解压:$tar -xzf nginx-1.12.2.tar.gz
解压缩后文件目录内文件有:[nginx-1.12.2]$ ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE Makefile man objs README src usr
3.切换到解压后的目录:$cd nginx-1.12.2
4.设置安装目录和启用的模块:[nginx-1.12.2]$./configure --prefix=安装目录(nginx) --add-module=添加模块 --with-http_ssl_module
参数说明: --prefix 指定nginx编译后的安装目录,这里假设为nginx
--add-module 为添加的第三方模块
--with..._module 表示启用的nginx模块,如此处启用了http_ssl_module模块
5.编译:$make
6.安装$make install
测试是否安装完成可以执行$./sbin/nginx -t
安装后安装目录内文件夹有:[安装目录(nginx)]$ ls
client_body_temp conf fastcgi_temp html logs proxy_temp sbin scgi_temp uwsgi_temp
nginx配置文件在安装目录(nginx)/conf/nginx.conf,可以进行http、负载均衡、cgi等配置,测试配置是否通过可以执行$./nginx/sbin/nginx -t
参考:https://www.cnblogs.com/luobiao320/p/7189934.html
二、spawn-fcgi下载安装
源码下载地址:http://redmine.lighttpd.net/news/7
1.下载:$wget http://www.lighttpd.net/download/spawn-fcgi-1.6.3.tar.gz
2.解压:$tar -xzf spawn-fcgi-1.6.3.tar.gz
解压缩后文件目录内文件有:[spawn-fcgi-1.6.3]$ ls
aclocal.m4 CMakeLists.txt config.log configure.ac doc Makefile.am NEWS spawn-fcgi.1
AUTHORS config.h config.status COPYING install-sh Makefile.in README src
autogen.sh config.h.in configure depcomp Makefile missing spawn-fcgi stamp-h1
3.切换到解压后的目录:$cd spawn-fcgi-1.6.3
4.设置安装目录:[spawn-fcgi-1.6.3]$./configure --prefix=安装目录(spawn-fcgi)
5.编译安装:[spawn-fcgi-1.6.3]$make&&make install
安装后安装目录内文件夹有:[安装目录(spawn-fcgi)]$ ls
bin share
参考:https://www.cnblogs.com/skynet/p/4173450.html
三、fcgi下载安装
源码下载地址:ftp://ftp.slackware.com/.2/gentoo/distfiles
1.下载:$wget ftp://ftp.slackware.com/.2/gentoo/distfiles/fcgi-2.4.0.tar.gz
2.解压:$tar -xzf fcgi-2.4.0.tar.gz
解压缩后文件目录内文件有:[ fcgi-2.4.0]$ls
acinclude.m4 config.guess configure examples include libtool Makefile.am mkinstalldirs stamp-h1
aclocal.m4 config.log configure.in fcgi_config.h install-sh LICENSE.TERMS Makefile.in perl stamp-h.in
cgi-fcgi config.status depcomp fcgi_config.h.in java ltmain.sh Makefile.nt README Win32
compile config.sub doc images libfcgi Makefile missing stamp-h
3.切换到解压后的目录:$cd fcgi-2.4.0
4.设置安装目录:[fcgi-2.4.0]$./configure --prefix=安装目录(fcgi)
5.编译安装:$make&&make install
若出现error: 'EOF' was not declared in this scope的话 在fcgi-2.4.0/include/fcgio.h文件中加上 #include <cstdio>
安装后安装目录内文件夹有:[安装目录(fcgi)]$ ls
bin include lib
参考:https://www.cnblogs.com/skynet/p/4173450.html
四、cgicc库下载安装
命令如下:
$wget http://ftp.gnu.org/gnu/cgicc/cgicc-3.2.19.tar.gz
$tar xzf cgicc-X.X.X.tar.gz $cd cgicc-X.X.X/ $./configure --prefix=/安装目录(cgicc) $make $make install
至此环境搭建完成,下一步就是编写C++程序,编译为cgi文件,修改nginx.conf配置文件,启动 cgi程序,就可以通过浏览器或者curl进行访问cgi服务了。下回分解。