LNMP架构介绍、MySQL安装、php安装、Nginx介绍

LNMP架构介绍、MySQL安装、php安装、Nginx介绍_第1张图片
LNMP架构介绍

MySQL安装

LNMP架构介绍、MySQL安装、php安装、Nginx介绍_第2张图片
MySQL安装

如果要删除mysql

[root@wsl-001 ~]# ps aux |grep mysql
root      65776  0.0  0.0 115388  1720 ?        S    4月18   0:00 /bin/sh /usr/local/mariadb/bin/mysqld_safe --defaults-file=/usr/local/mariadb/my.cnf --datadir=/data/mariadb --pid-file=/data/mariadb/wsl-001.pid
mysql     65888  0.0  2.7 1585716 51896 ?       Sl   4月18   0:59 /usr/local/mariadb/bin/mysqld --defaults-file=/usr/local/mariadb/my.cnf --basedir=/usr/local/mariadb --datadir=/data/mariadb --plugin-dir=/usr/local/mariadb/lib/plugin --user=mysql --log-error=/data/mariadb/wsl-001.err --pid-file=/data/mariadb/wsl-001.pid --socket=/tmp/mysql.sock --port=3306
root      75488  0.0  0.0 112676   984 pts/0    R+   20:54   0:00 grep --color=auto mysql
[root@wsl-001 ~]# /etc/init.d/mysqld stop
 ERROR! MySQL server PID file could not be found!
[root@wsl-001 ~]# /etc/init.d/mariadb stop
Stopping mariadb (via systemctl):                          [  确定  ]
[root@wsl-001 ~]# ps aux |grep mysql
root      75544  0.0  0.0 112676   984 pts/0    R+   20:55   0:00 grep --color=auto mysql
[root@wsl-001 ~]# rm -rf /usr/local/mysql/
[root@wsl-001 ~]# rm -rf /etc/init.d/mysqld 
[root@wsl-001 ~]# rm -rf /etc/my.cnf (可保留)

安装mysql

[root@iZbp1e0xboek6oow616aoiZ ~]# cd /usr/local/src/
[root@iZbp1e0xboek6oow616aoiZ src]# wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz 
[root@iZbp1e0xboek6oow616aoiZ src]# tar zxvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
[root@iZbp1e0xboek6oow616aoiZ src]# mv mysql-5.6.35-linux-glibc2.5-x86_64 /usr/local/mysql
[root@iZbp1e0xboek6oow616aoiZ mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
[root@iZbp1e0xboek6oow616aoiZ mysql]# echo $?
0
[root@iZbp1e0xboek6oow616aoiZ mysql]# cp support-files/my-default.cnf  /etc/my.cnf 
cp:是否覆盖"/etc/my.cnf"? y
[root@iZbp1e0xboek6oow616aoiZ mysql]#  cp support-files/mysql.server /etc/init.d/mysqld
[root@wsl-001 mysql]# vim /etc/my.cnf

basedir=/usr/local/mysql
datadir=/data/mysql

[root@iZbp1e0xboek6oow616aoiZ support-files]# vi /etc/init.d/mysqld

basedir=/usr/local/mysql
datadir=/data/mysql

[root@iZbp1e0xboek6oow616aoiZ ~]# chkconfig --add mysqld (设置开机启动)
[root@iZbp1e0xboek6oow616aoiZ ~]# chkconfig  mysqld on

[root@iZbp1e0xboek6oow616aoiZ support-files]# /etc/init.d/mysqld start
Starting MySQL.Logging to '/data/mysql/iZbp1e0xboek6oow616aoiZ.err'.
                                                           [  确定  ]

[root@iZbp1e0xboek6oow616aoiZ ~]# ps aux |grep mysql
root     10704  0.0  0.0 113264  1616 pts/2    S    21:14   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/iZbp1e0xboek6oow616aoiZ.pid
mysql    10839  0.3 23.9 974004 450452 pts/2   Sl   21:14   0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/iZbp1e0xboek6oow616aoiZ.err --pid-file=/data/mysql/iZbp1e0xboek6oow616aoiZ.pid --socket=/tmp/mysql.sock
root     10869  0.0  0.0 112676   980 pts/1    R+   21:16   0:00 grep --color=auto mysql

php安装

LNMP架构介绍、MySQL安装、php安装、Nginx介绍_第3张图片
php安装

LNMP架构介绍、MySQL安装、php安装、Nginx介绍_第4张图片
php安装

如果安装有php,需要到src源文件下 meke clean

[root@iZbp1e0xboek6oow616aoiZ ~]# cd /usr/local/src/
[root@iZbp1e0xboek6oow616aoiZ src]# wget http://cn2.php.net/distributions/php-5.6.30.tar.gz
[root@iZbp1e0xboek6oow616aoiZ src]# tar zxf php-5.6.30.tar.gz
[root@iZbp1e0xboek6oow616aoiZ src]# useradd -s /sbin/nologin php-fpm
[root@iZbp1e0xboek6oow616aoiZ src]# cd php-5.6.30
[root@iZbp1e0xboek6oow616aoiZ php-5.6.30]# ./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --with-pear --with-curl  --with-openssl
[root@iZbp1e0xboek6oow616aoiZ php-5.6.30]# echo $?
0
[root@iZbp1e0xboek6oow616aoiZ php-5.6.30]# make && make install
[root@iZbp1e0xboek6oow616aoiZ php-5.6.30]# echo $?
0
[root@iZbp1e0xboek6oow616aoiZ php-5.6.30]# /usr/local/php-fpm/bin/php -m
[PHP Modules]
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
hash
iconv
json
libxml
mbstring
mcrypt
mysql
mysqli
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
soap
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlib

[Zend Modules]
[root@iZbp1e0xboek6oow616aoiZ php-5.6.30]# cp php.ini-production /usr/local/php-fpm/etc/php.ini
[root@iZbp1e0xboek6oow616aoiZ php-5.6.30]# vim /usr/local/php-fpm/etc/php-fpm.conf

[global]
pid = /usr/local/php-fpm/var/run/php-fpm.pid
error_log = /usr/local/php-fpm/var/log/php-fpm.log
[www]
listen = /tmp/php-fcgi.sock
#listen = 127.0.0.1:9000
listen.mode = 666
user = php-fpm
group = php-fpm
pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
rlimit_files = 1024

[root@iZbp1e0xboek6oow616aoiZ php-5.6.30]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@iZbp1e0xboek6oow616aoiZ php-5.6.30]# chmod 755 /etc/init.d/php-fpm
[root@iZbp1e0xboek6oow616aoiZ php-5.6.30]# chkconfig --add php-fpm
[root@iZbp1e0xboek6oow616aoiZ php-5.6.30]# chkconfig php-fpm on
[root@iZbp1e0xboek6oow616aoiZ php-5.6.30]# service php-fpm start
Starting php-fpm  done
[root@iZbp1e0xboek6oow616aoiZ php-5.6.30]# ps aux |grep php-fpm
root     10906  0.0  0.2 123612  4948 ?        Ss   22:15   0:00 php-fpm: master process (/usr/local/php-fpm/etc/php-fpm.conf)
php-fpm  10907  0.0  0.2 123612  4708 ?        S    22:15   0:00 php-fpm: pool www
php-fpm  10909  0.0  0.2 123612  4708 ?        S    22:15   0:00 php-fpm: pool www
php-fpm  10910  0.0  0.2 123612  4708 ?        S    22:15   0:00 php-fpm: pool www
php-fpm  10911  0.0  0.2 123612  4708 ?        S    22:15   0:00 php-fpm: pool www
php-fpm  10912  0.0  0.2 123612  4712 ?        S    22:15   0:00 php-fpm: pool www
php-fpm  10913  0.0  0.2 123612  4712 ?        S    22:15   0:00 php-fpm: pool www
php-fpm  10914  0.0  0.2 123612  4712 ?        S    22:15   0:00 php-fpm: pool www
php-fpm  10915  0.0  0.2 123612  4712 ?        S    22:15   0:00 php-fpm: pool www
php-fpm  10916  0.0  0.2 123612  4712 ?        S    22:15   0:00 php-fpm: pool www
php-fpm  10917  0.0  0.2 123612  4716 ?        S    22:15   0:00 php-fpm: pool www
php-fpm  10918  0.0  0.2 123612  4716 ?        S    22:15   0:00 php-fpm: pool www
php-fpm  10919  0.0  0.2 123612  4716 ?        S    22:15   0:00 php-fpm: pool www
php-fpm  10920  0.0  0.2 123612  4716 ?        S    22:15   0:00 php-fpm: pool www
php-fpm  10921  0.0  0.2 123612  4716 ?        S    22:15   0:00 php-fpm: pool www
php-fpm  10922  0.0  0.2 123612  4716 ?        S    22:15   0:00 php-fpm: pool www
php-fpm  10923  0.0  0.2 123612  4716 ?        S    22:15   0:00 php-fpm: pool www
php-fpm  10924  0.0  0.2 123612  4716 ?        S    22:15   0:00 php-fpm: pool www
php-fpm  10925  0.0  0.2 123612  4716 ?        S    22:15   0:00 php-fpm: pool www
php-fpm  10926  0.0  0.2 123612  4716 ?        S    22:15   0:00 php-fpm: pool www
php-fpm  10927  0.0  0.2 123612  4716 ?        S    22:15   0:00 php-fpm: pool www
root     10929  0.0  0.0 112676   980 pts/2    R+   22:15   0:00 grep --color=auto php-fpm

Nginx介绍

LNMP架构介绍、MySQL安装、php安装、Nginx介绍_第5张图片
Nginx介绍

扩展
Nginx为什么比Apache Httpd高效:原理篇 http://www.toxingwang.com/linux-unix/linux-basic/1712.html
apache和nginx工作原理比较 http://www.server110.com/nginx/201402/6543.html
mod_php 和 mod_fastcgi以及php-fpm的比较 http://dwz.cn/1lwMSd
概念了解:CGI,FastCGI,PHP-CGI与PHP-FPM http://www.nowamagic.net/librarys/veda/detail/1319/ https://www.awaimai.com/371.html

你可能感兴趣的:(LNMP架构介绍、MySQL安装、php安装、Nginx介绍)