美文网首页
hi-nginx踩坑

hi-nginx踩坑

作者: 3869c3f1f1e8 | 来源:发表于2018-11-16 14:52 被阅读0次

下载最新代码:

git clone https://github.com/webcpp/hi-nginx.git

依赖安装:

sudo yum install gcc gcc-c++ make pcre-devel zlib-devel openssl-devel python36-devel lua-devel

进入hi-nginx文件夹,找到install_demo.sh,编辑install_demo.sh脚本:

#!/bin/bashif ! test -f Makefile;then./configure \ --with-cc=gcc \ --with-http_ssl_module \ --with-http_v2_module \ --prefix=/usr/local/nginx \ --enable-http-hi-cpp=YES \ --enable-http-hi-python=YES \ --enable-http-hi-lua=NO \ --enable-http-hi-java=NO \ --enable-http-hi-php=NO \ --with-http-hi-python-version=python3 \ --with-http-hi-lua-version=lua5.3 \ --add-module=ngx_http_hi_module \ --add-module=3rd/nchan-1.2.3 \ --add-module=3rd/nginx-rtmp-module-1.2.1else echo ready.fi

编译安装:

./install_demo.sh

make && make install


可能发生错误:

1.无法识别的命令行选项“-std=c++11”

解决方案:升级gcc-c++版本,至少4.8+,centos6.x yum的最高版本是4.4.7,需要手动升级。推荐使用centos7.x,gcc-c++版本刚刚好。

组件库:http://gcc.gnu.org/pub/gcc/infrastructure/

升级gcc-c++ 需要先保证以下三个组件的版本必须比文档中的高,如组件不存在需要安装

wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2

wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2

wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz

第一个安装GMP,在根目录下创建gmp-build用于存放编译后的文件,进去gmp-build

../configure --prefix=/usr/local/gmp-4.3.2

make && make check && make install

第二个安装MPFR

./configure --prefix=/usr/local/mpfr-2.4.2 --with-gmp=/usr/local/gmp-4.3.2

最后安装MPC

./configure --prefix=/usr/local/mpc-0.8.1 --with-gmp=/usr/local/gmp-4.3.2 --with-mpfr=/usr/local/mpfr-2.4.2

tar -xf gcc-4.8.2.tar.gz

cd gcc-4.8.2

./contrib/download_prerequisites

mkdir gcc-build-4.8.2 

cd gcc-build-4.8.2

../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib --with-gmp=/usr/local/gmp-4.3.2 --with-mpfr=/usr/local/mpfr-2.4.2 --with-mpc=/usr/local/mpc-0.8.1

make && make install  编译过程时间很长。。。请耐心等待。。。

2.Python,centos默认安装Python2.7,如果用到Python3.x需自行安装

两种安装方式

1.安装包安装

wget https://www.python.org/ftp/python/3.x.x/Python-3.x.x.tar.xz

./configure && make && make test && sudo make install

可能会报错:ModuleNotFoundError: No module named '_ctypes'

解决方案:yum install libffi-devel -y

2.yum安装

sudo yum install epel-release

sudo yum install python36

安装完成,进行配置

查看是否安装成功:python3 -V

3.pip或pip3安装pkgconfig

pip install pkgconfig

pip3 install pkgconfig

hi-nginx安装位置

nginx path prefix: "/usr/local/nginx"

nginx binary file: "/usr/local/nginx/sbin/nginx"

nginx modules path: "/usr/local/nginx/modules"

nginx configuration prefix: "/usr/local/nginx/conf"

nginx configuration file: "/usr/local/nginx/conf/nginx.conf"

nginx pid file: "/usr/local/nginx/logs/nginx.pid"

nginx error log file: "/usr/local/nginx/logs/error.log"

nginx http access log file: "/usr/local/nginx/logs/access.log"

注:记得关闭防火墙,或者开放监听端口!

相关文章

  • hi-nginx踩坑

    下载最新代码: git clonehttps://github.com/webcpp/hi-nginx.git 依...

  • JavaScrip-StepPitGuide《JavaScrip

    《JavaScript踩坑指南》JavaScrip-StepPitGuide? 《JavaScript踩坑指南》 ...

  • 算法踩坑6-二叉搜索树排序

    背景 接上面五篇文章算法踩坑-快速排序 算法踩坑2-插入排序 算法踩坑3-堆排序 算法踩坑4-冒泡排序 ...

  • 算法踩坑5-归并排序

    背景 接上面四篇文章算法踩坑-快速排序 算法踩坑2-插入排序 算法踩坑3-堆排序 算法踩坑4-冒泡排序 来...

  • D1094:踩坑的价值最大化

    是人就会踩坑,不踩坑理论上就不属于人类,踩坑是人之常情,能回头站在坑边反思,才是对踩过的的坑价值最大化的体现,要不...

  • 交互设计师所要避免的几个坑

    前言 工作中难免会踩到几个坑,即使现在不踩以后还会踩,只有踩过才会深刻记住,踩过说明爱过!但是踩过的坑必须把坑填满...

  • 踩坑,使用cocoaPods import导入时没有提示的解决办

    续上篇写的,踩坑,cocoaPods ---- framework not found Pods之后 ,又踩坑了。...

  • 2020-10-19随笔 踩坑0传值

    踩坑:当值传入0时,if条件判断时候会自己转换,记录踩坑。

  • 随笔

    读书啊,就是一个坑踩完了又掉进另一个坑,先说踩读书没用的坑,爬出来了,再踩读书要多的坑,之后再踩读书要精啊,读书要...

  • PHP中的数据类型

    一说到数据类型,这个坑就太多了,多到有哪些坑,有多少坑,不知道自己还会踩哪些坑,以及踩过的坑还会不会再踩,我对...

网友评论

      本文标题:hi-nginx踩坑

      本文链接:https://www.haomeiwen.com/subject/ensxxqtx.html