Introduction to LNMP architecture, MySQL installation, PHP installation, Nginx introduction

LNMP architecture introduction:

 

MySQL installation:

cd /usr/local/src

wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz = Download the installation package

tar zxvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz = extract the installation package

mv mysql-5.6.35-linux-glibc2.5-x86_64 /usr/local/mysql = After decompression, you need to move to another path and change the name of the directory

cd /usr/local/mysql = enter the changed directory

useradd mysql = create a new MYSQL new user

mkdir /data/ = create a data directory if it exists then it can be omitted

./scripts/mysql_install_db --user=mysql --datadir=/data/mysql = After initialization, use the command echo $? to judge whether the command initialization is correct. Error in initialization: bad interpreter: no such file or directory. Use the command to install yum install perl gcc kernel-devel datadir=/usr/local/mysql/data/mysql = Absolute path needs to be written to compile datadir   

cp support-files/my-default.cnf /etc/my.cnf = Copy a configuration file to the /etc/ directory and rename it to my.cnf, then define both basedir and datadir in vim /etc/my.cnf define absolute path

cp support-files/mysql.server /etc/init.d/mysqld = copy a configuration file for the startup script

vi /etc/init.d/mysqld = The startup script file also defines basedir and datadir

/etc/init.d/mysqld start = start the mysql service

   = start successfully

[root@aming-01 mysql]#  chkconfig --add mysqld   加入服务项
[root@aming-01 mysql]# chkconfig mysqld on    开机启动

 

PHP installation:

cd /usr/local/src/

wget http://cn2.php.net/distributions/php-5.6.30.tar.gz = Download the required installation package

tar zxf php-5.6.30.tar.gz = extract the installation package  

useradd -s /sbin/nologin php-fpm=create a new user

cd php-5.6.30 = enter the decompressed installation package 

./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    = 编译php文件

make && make install = continue installation                         make clean = delete previously compiled php files

cp php.ini-production /usr/local/php-fpm/etc/php.ini = copy a configuration file to another directory    

vi /usr/local/php-fpm/etc/php-fpm.conf //Write the following content (refer to https://coding.net/u/aminglinux/p/aminglinux-book/git/blob/master/D15Z /php-fpm.conf = browser opens and writes to php-fpm.conf) The following is the code that needs to be written

[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.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

cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm = copy startup script to /etc/init.d/php-fpm

chmod 755 /etc/init.d/php-fpm = increase startup script permissions

chkconfig --add php-fpm = add boot service

chkconfig php-fpm on = enable startup service

service php-fpm start = start the service

ps aux | grep php-fpm = view service process

Compilation issue 1: curl is missing Solution: yum install -y libcurl-devel

 

 Nginx introduction:

 

 

 

Why extending
Nginx is more efficient than Apache Httpd: Principle  http://www.toxingwang.com/linux-unix/linux-basic/1712.html
Comparison of working principles of apache and  nginxhttp ://www.server110.com/nginx/201402 /6543.html Comparison of
mod_php and mod_fastcgi and php-fpm  http://dwz.cn/1lwMSd

Conceptual understanding: CGI, FastCGI, PHP-CGI and PHP-FPM

http://www.nowamagic.net/librarys/veda/detail/1319/ https://www.awaimai.com/371.html

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325720853&siteId=291194637