zoukankan      html  css  js  c++  java
  • LNMP中nginx和php的安装流程

    L:linux(系统的安装略过,本文不涉及)

    M: Mysql(本文略过)

    N: nginx

    P: PHP

    首先安装nginx

    1. 下载源代码:到 http://wiki.nginx.org/Install 上下载,放到/usr/src/software/nginx 下。(题外话,wiki.nginx.org 是个好网站,文档很全,没事的时候可多上去看看。)

    注意,nginx的一些模块依赖于一些第三方软件,例如PCRE, OPENSSL, zlib等等,需要事先安装它们。

    2. 下载几个相当有用的第三方写的Nginx扩展模块,统一放在/usr/src/nginx/exp(题外话,写Nginx模块挺有意思,有空的时候可以自己写写,有助于提升)

    1) echo-nginx-module (https://github.com/agentzh/echo-nginx-module,http://wiki.nginx.org/HttpEchoModule)

    2) lua-nginx-module (http://wiki.nginx.org/HttpLuaModule)

    3) set-misc-nginx-module (https://github.com/agentzh/set-misc-nginx-module)

    4) ngx_cache_purge

    以上的模块安装过程可参考wiki.nginx.org上的对应页面

    其次,我们安装PHP:

    1. 首先下载PHP源代码 (http://www.php.net)

    2. 解压后,进行配置 ./configure [各种参数]

    有个编译的实例:

    ./configure  --disable-debug --prefix=/usr/local/php --enable-shmop --with-gd --with-jpeg-dir=/usr/lib64 --with-png-dir=/usr/lib64 --with-libxml-dir=/usr/lib64 --with-zlib-dir=/usr/local/lib --with-mysqli=mysqlnd --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --enable-sockets --with-iconv --enable-mbstring --enable-mbregex --enable-ftp --enable-gd-native-ttf --with-curl --enable-fpm --enable-pcntl --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-zip --with-freetype-dir

    其中,

    --prefix=[path]: 设定安装路径

    --disable-debug: 编译时禁止加入调试符号

    --enable-shmop: 启用shmop模块。Shmop is an easy to use set of functions that allows PHP to read, write, create and delete Unix shared memory segments.

    --with-gd: 增加GD库的支持。GD库,是php处理图形的扩展库。

    --with-jpeg-dir=[DIR]: GD库中jpeg lib的安装路径的prefix

    '--with-png-dir=/usr/lib64' '--with-libxml-dir=/usr/lib64' '--with-zlib-dir=/usr/lib64': 与--with-jpeg-dir类似

    --with-mysqli=FILE: 包含mysqli的支持。如果DIR取值为mysqlnd,则 the MySQL native driver will be used mysql_config

    --with-mysql=DIR: 包含mysql的支持。如果DIR取值为mysqlnd,则 the MySQL native driver will be used /usr/local

    --with-pdo-mysql=DIR: 支持PDO Mysql扩展模块。PDO扩展为PHP访问数据库定义了一个轻量级的、一致性的接口,它提供了一个数据访问抽象层,这样,无论使用什么数据库,都可以通过一致的函数执行查询和获取数据。如果DIR取值为mysqlnd,则 the MySQL native driver will be used /usr/local

    --enable-sockets: 增加socket支持

    --with-iconv-dir=DIR: 激活iconv,iconv是默认激活的,会到默认路径中区搜索。iconv函数库能够完成各种字符集间的转换,是php编程中不可缺少的基础函数库。

    --enable-mbstring: Enable multibyte string support

    --enable-mbregex:该选项默认开启。 MBSTRING: enable multibyte regex(正则表达式) support

    --enable-ftp: Enable FTP support

    --enable-gd-native-ttf: GD: Enable TrueType string function (ttf: TrueType string)

    --with-curl=[DIR]: Include cURL support

    --enable-fpm: Enable building of the fpm SAPI executable (非常重要的一个选项,用来开启FPM的支持)

    --enable-pcntl: Enable pcntl support (CLI/CGI only) (php进程控制扩展)

    --enable-sysvmsg: Enable sysvmsg support. 即System V消息队列

    --enable-sysvsem: Enable sysvsem support. 即System V信号量

    -enable-sysvshm: Enable sysvshm support. 即System V共享内存

    php中对共享内存段的操作有两组函数:System V IPCShared Memory。 其中System V IPC系列函数能够更方便的操作数据,无需像Shared Memory那样必须自己掌握读写时的偏移量、长度等,也不用序列化/反序列化来回转换(因为Shared Memory函数只支持字符串格式的数据参数)。但是System V IPC系列不支持Windows,所以如果要在win环境下使用,只能选Shared Memory。

    '--enable-zip': Include Zip read/write support

    --with-freetype-dir=DIR: GD库相关。 GD: Set the path to FreeType 2 install prefix

  • 相关阅读:
    Python基础语法 第2节课(数据类型转换、运算符、字符串)
    python基础语法 第5节课 ( if 、 for )
    python基础语法 第4节课 (字典 元组 集合)
    Python基础语法 第3节课 (列表)
    A. Peter and Snow Blower 解析(思維、幾何)
    C. Dima and Salad 解析(思維、DP)
    D. Serval and Rooted Tree (樹狀DP)
    C2. Balanced Removals (Harder) (幾何、思維)
    B. Two Fairs 解析(思維、DFS、組合)
    D. Bash and a Tough Math Puzzle 解析(線段樹、數論)
  • 原文地址:https://www.cnblogs.com/hencehong/p/2977992.html
Copyright © 2011-2022 走看看