Nginx

CentOS:

  1. 下载源代码
  2. 安装依赖包

    yum install -y pcre-devel zlib-devel
    
  3. 编译、安装和配置

    ./configure && make && make install
    

MySQL

CentOS:

  1. 安装官方源

    $ wget -cv https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
    $ rpm -Uvh mysql80-community-release-el7-1.noarch.rpm
    
  2. 修改 /etc/yum.repos.d/mysql-community.repo,启用需要的 MySQL 版本

  3. 安装 MySQL
    $ yum install mysql-community-server
    $ service mysqld start
    $ # MySQLd root 的初始密码会输出到日志文件 /var/log/mysqld.log 中
    $ mysql_secure_installation     # For MySQL 5.6+
    

PHP

CentOS:

  1. 下载源代码
  2. 安装依赖包

    yum install -y gcc yum-utils libxml2-devel openssl-devel libcurl-devel libmcrypt-devel \
        bzip2-devel libvpx-devel libjpeg-devel libpng-devel libXpm-devel libtools-ltdl-devel \
        freetype-devel
    
  3. 编译安装

    $ ./configure --with-libdir=lib64 --with-mysql --with-mysqli=/bin/mysql_config \
        --with-iconv-dir --with-zlib \
        --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath \
        --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl \
        --enable-mbregex --enable-fpm --enable-mbstring \
        --with-mcrypt --enable-ftp --with-openssl \
        --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip \
        --enable-soap --with-pear --with-gettext --enable-fpm --with-fpm-user=nobody \
        --with-fpm-group=nobody --with-bz2 --with-curl \
        --with-gd --enable-gd-native-ttf --with-jpeg-dir=/usr --with-vpx-dir=/usr \
        --with-png-dir=/usr --with-xpm-dir=/usr --with-freetype-dir=/usr/include/freetype2
    
    $ make; make install
    
    • 如果 mysqli 编译失败, 大概率是因为 MySQL 版本和 PHP 版本不匹配。可以尝试降低 MySQL 版本,或者升级 PHP 版本试试。
    • 还可将 mysqli 编译为插件
      $ cd php-src/ext/mysqli
      $ phpize
      $ ./configure
      $ make; make install
      $ echo "extension=mysqli.so;" >>/usr/local/lib/php.ini
      
  4. 配置启动

    $ cp php.ini-production /usr/local/lib/php.ini
    $ php --ini
    $ cd /usr/local/etc; mv php-fpm.conf.default php-fpm.conf
    $ php-fpm
    

phpMyAdmin

  1. 下载源代码并解压到目标目录
  2. 访问 phpMyAdmin/setup/index.php 生成配置文件 config.inc.php 内容
    • 使用 cookie 认证模式和 MySQL root 密码
Comments

不要轻轻地离开我,请留下点什么...

comments powered by Disqus

Published

Category

Nginx

Tags

Contact