LNMP环境搭建:
lnmp介绍
nginx源码安装
mysql源码安装
php源码安装
lnmp介绍:
LNMP是指一组通常一起使用来运行动态网站或者服务器的自由软件名称首字母缩写。L指Linux,N指Nginx,M一般指MySQL,也可以指MariaDB(此处安装以mysql为例),P一般指PHP,也可以指Perl或Python(此处安装以php为例)。
nginx安装
1、安装依赖
yum -y install gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel
2、下载源码
wget http://nginx.org/download/nginx-1.23.3.tar.gz
3、解压编译安装
tar xf nginx-1.23.0.tar.gz
cd nginx-1.23.0
./configure --user=www --group=www -prefix=/usr/local/nsing --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-threads
make && make install
4、查看版本
/usr/local/nginx/sbin/nginx -V
5、检查配置文件是否正确
/usr/local/nginx/sbin/nginx -t
6、启动nginx进程
/usr/local/nginx/sbin/nginx
7、查看进程
ps -ef | grep nginx
8、关闭nginx进程
/usr/local/nginx/sbin/nginx
9、重载
/usr/local/nginx/sbin/nginx -s reload
10、安装完成
mysql源码安装
php源码安装
1、下载安装包
http://www.php.net/downloads.php
2、yum安装环境
yum -y install
libjpeg
libjpeg-devel
libpng libpng-devel
freetype freetype-devel
libxml2
libxml2-devel
zlib zlib-devel
curl curl-devel
openssl openssl-devel
3、解压安装包
tar xjvf php-7.1.10.tar.bz2
4、编译安装
cd php-7.1.10
./configure \ --prefix=/usr/local/php \
–with-apxs2=/usr/local/httpd/bin/apxs
–with-mysql-sock=/usr/local/mysql/mysql.sock
–with-mysqli
–with-zlib
–with-curl
–with-gd
–with-jpeg-dir
–with-png-dir
–with-freetype-dir
–with-openssl
–enable-mbstring
–enable-xml
–enable-session
–enable-ftp
–enable-pdo
–enable-tokenizer
–enable-zip
make && make install