一 介绍LNMP
有两种架构是目前网站的主流架构
LAMP = Linux + Apache + MySQL +PHP
LNMP = Linux + Nginx + MySQL +PHP
LAMP和LNMP是一组常用来搭建动态网站或者服务器的开源软件,本身都是各自独立的程序,但是因为常被放到一起使用,拥有了越来越高的兼容度,共同组成了一个强大的Web应用程序平台。
Linux: 开源免费软件,作为网站的操作系统
Apache/Nginx: Web服务器软件
MySQL: 多线程多用户的数据库管理系统,用来存放数据
PHP: 服务器端的应用程序软件,快速执行动态网页
因为LNMP 是 Linux、Nginx、MySQL 和 PHP 的缩写,这个组合是最常见的 Web 服务器的运行环境
So ,今天主要说一下 LNMP
准备好需要编译的源码包 我已经准备好了
mysql-boost-5.7.17.tar.gz
nginx-1.14.0.tar.gz
php-5.6.20.tar.bz2
编译安装Nginx
tar zxf nginx-1.14.0.tar.gz
cd nginx-1.14.0
cd src/core/
vim nginx.h
14 #define NGINX_VER "nginx" 修改标示符
关掉debug 加快编译进度
编译三部曲第一部
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-threads --with-file-aio --without-http_rewrite_module
编译三部曲第二步
make
编译三部曲第三步
make install
做好软链接
ln -s /usr/local/lnmp/nginx/sbin/nginx /usr/sbin/
检查nginx 并启动
在浏览器查看
编译安装mysql
建立mysql用户
编译安装Php
做好准备工作
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel openssl openssl-devel openldap openldap-devel gd gd2 gd-devel gd2-devel perl-CPAN pcre-devel
解压
tar xvf php-5.6.20.tar.bz2
cd /usr/local/src/
进入解压文件内,通过./configure 命令进行配置
./configure –prefix=/usr/local/php –with-config-file-path=/etc/php
–enable-fpm –enable-pcntl –enable-mysqlnd –enable-opcache –enable-sockets –enable-sysvmsg –enable-sysvsem –enable-sysvshm –enable-shmop –enable-zip –enable-soap –enable-xml –enable-mbstring –disable-rpath –disable-debug –disable-fileinfo –with-mysqli=mysqlnd –with-pdo-mysql=mysqlnd –with-pcre-regex –with-iconv –with-zlib –with-gd –with-openssl –with-mhash –with-xmlrpc –with-curl –with-imap-ssl
make
make install