本文共 3453 字,大约阅读时间需要 11 分钟。
#添加Nginx、Php最新源并刷新源sudo add-apt-repository ppa:nginx/stablesudo add-apt-repository ppa:ondrej/phpsudo apt-get update#安装Nginxsudo apt-get install nginx#安装Php7.1 FPMsudo apt-get install php7.1-fpm#php7.1 curl扩展sudo apt-get install php7.1-curl#安装Mysqlsudo install mysql-server#备份Mysql数据库mysqldump -u root -p 欲备份的数据库名 > 导出的数据库名.sql#恢复mysql数据库mysql -u root -p 恢复的数据库名 < 导出过的数据库名.sql#如恢复的数据库不存在 需要手动创建create database 恢复的数据库名;
#下载并解压Nginx源码wget -c https://nginx.org/download/nginx-1.11.4.tar.gztar -zxvf nginx-1.11.4.tar.gz#下载并解压OpenSSL源码wget -c https://www.openssl.org/source/openssl-1.1.0.tar.gztar -zxvf openssl-1.1.0.tar.gz#下载并解压nginx-ct源码wget -O nginx-ct.zip -c https://github.com/grahamedgecombe/nginx-ct/archive/v1.3.0.zipunzip nginx-ct.zip#修复Nginx/1.11.3无法编译的问题此问题在Nginx 1.11.4已经解决,1.11.4请忽略#由于OpenSSL 1.1.0 删除了 SSL_R_NO_CIPHERS_PASSED导致Nginx无法编译。这里我们需要修复nginx源码中的[一个文件](https://github.com/nginx/nginx/commit/af9e72533a69de3b8b7ed59be7be9b37203b5c82)#用文本编辑器打开 ./nginx-1.11.3/src/event/ngx_event_openssl.c#找到这个位置,大约在第2000行附近if (n == SSL_R_BAD_CHANGE_CIPHER_SPEC /* 103 */ || n == SSL_R_BLOCK_CIPHER_PAD_IS_WRONG /* 129 */ || n == SSL_R_DIGEST_CHECK_FAILED /* 149 */ || n == SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST /* 151 */ || n == SSL_R_EXCESSIVE_MESSAGE_SIZE /* 152 */ || n == SSL_R_LENGTH_MISMATCH /* 159 */ || n == SSL_R_NO_CIPHERS_PASSED /* 182 */ 修改为if (n == SSL_R_BAD_CHANGE_CIPHER_SPEC /* 103 */ || n == SSL_R_BLOCK_CIPHER_PAD_IS_WRONG /* 129 */ || n == SSL_R_DIGEST_CHECK_FAILED /* 149 */ || n == SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST /* 151 */ || n == SSL_R_EXCESSIVE_MESSAGE_SIZE /* 152 */ || n == SSL_R_LENGTH_MISMATCH /* 159 */#ifdef SSL_R_NO_CIPHERS_PASSED || n == SSL_R_NO_CIPHERS_PASSED /* 182 */#endif#保存#编译Nginx#进入Nginx源码目录cd ./nginx-1.11.4#生成编译配置./configure \#设置OpenSSL源码目录--with-openssl=../openssl-1.1.0 \#设置nginx-ct源码目录--add-module=../nginx-ct-1.3.0 \--with-debug \--with-pcre-jit \--with-ipv6 \--with-http_ssl_module \#启用HTTP/2.0模块--with-http_v2_module \--with-http_stub_status_module \--with-http_realip_module \--with-http_auth_request_module \--with-http_addition_module \--with-http_dav_module \--with-http_gzip_static_module \--with-http_sub_module \--with-mail \--with-mail_ssl_module#如无缺失依赖库,将会生成MakeFile#开始编译make#编译完成后安装sudo make install#默认安装在 /usr/local/nginx 下#install Nginx End.
#从http://php.net/get/php-7.0.8.tar.gz/from/a/mirror 下载源码并解压tar -xzvf xxxx.tar.gz #安装依赖apt-get install libxml2-dev libssl-dev libcurl4-gnutls-dev libmcrypt-dev#解压镜像,然后进入文件夹中./configure --prefix=/usr/local/php7 \--exec-prefix=/usr/local/php7 \--bindir=/usr/local/php7/bin \--sbindir=/usr/local/php7/sbin \--includedir=/usr/local/php7/include \--libdir=/usr/local/php7/lib/php \--mandir=/usr/local/php7/php/man \--enable-mbstring \--with-curl \--with-gd \--with-config-file-path=/usr/local/php7/etc \--enable-fpm \--enable-mysqlnd \--with-pdo-mysql=mysqlnd \--with-mysql-sock=/var/run/mysqld/mysqld.sock#如提示缺少依赖包,请根据错误提示安装#开始编译make#编译测试make test#安装make install#install Php7 End.
转载地址:http://rbzeo.baihongyu.com/