Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction to LNMP architecture, Nginx and installation tutorials for MySQL and PHP

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the LNMP architecture, Nginx introduction and MySQL, PHP installation tutorials, the things involved, learned from the theoretical knowledge, there are many books, literature for your reference, from a practical point of view, accumulated years of practical experience can be shared with you.

12.1 LNMP architecture introduction is different from LAMP in that web services are provided by Nginx and PHP exists as a stand-alone service, which is called php-fpmNginx to handle static requests directly, and dynamic requests are forwarded to php-fpm

12.2 MySQL installation creation directory [root@taoyuan src] # mkdir-p / usr/local/src/ [root@taoyuan src] # tools required for cd / usr/local/src/yum installation [root@taoyuan src] # yum install-y wget [root@taoyuan mysql] # yum install-y vim download MySQL installation package [root@taoyuan src] # wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5- X86_64.tar.gz extract package [root@taoyuan src] # tar zxvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz copy directory [root@taoyuan src] # mv mysql-5.6.35-linux-glibc2.5-x86_64 / usr/local/mysql [root@taoyuan src] # cd.. [root@taoyuan local] # cd mysql create user and data directory [root@taoyuan mysql] # useradd mysql [root@taoyuan mysql] # mkdir / data/ initialization [root@taoyuan mysql]. / scripts/mysql_install_db-- user=mysql-- datadir=/data/mysql [root@taoyuan mysql] # echo $? 0 modify configuration file [root@taoyuan ~] # vim / etc/my.cnf [mysqld] # modify the path datadir=/data/mysqlsocket=/tmp/ as follows The mysql.sock# is annotated as the following parameter # logmurerrorbank etc/my.cnf.d# etc/my.cnf.d#: wq save exit startup script Need to copy to / etc/init.d/ directory [root@taoyuan mysql] # cp support-files/mysql.server / etc/init.d/mysqld [root@taoyuan mysql] # ls / etc/init.d/mysqld / etc/init.d/mysqld edit startup script # define basedir and datadirbasedir=/usr/local/mysqldatadir=/data/mysql#:wq save exit settings boot [root@taoyuan mysql] # chkconfig-add mysqld# adds mysqld to the service list Start the service [root@taoyuan mysql] # / etc/init.d/mysqld startStarting MySQL.Logging to'/ data/mysql/taoyuan.yun.err'. inside SUCCESS! 12.3-12.4 PHP install and download php installation package [root@taoyuan src] # wget http://cn2.php.net/distributions/php-5.6.30.tar.bz2 extract [root@taoyuan src] # tar jxvf php-5.6.30.tar.bz2 dependency support library file [root@taoyuan php-5.6.30] # yum install-y libxml2-devel [root@taoyuan php-5.6.30] # yum install-y openssl-devel [root @ taoyuan php-5.6.30] # yum install-y libcurl-devel [root@taoyuan php-5.6.30] # yum install-y epel-release [root@taoyuan php-5.6.30] # yum install-y libmcrypt-devel installation [root@taoyuan 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-zlib-dir-- with-mcrypt-- enable-soap-- enable-gd-native-ttf-- enable-ftp-- enable-mbstring-- enable-exif-- with-pear-- with-curl-- with-openssl

Make & & make install

Introduction to related directories and parameters # File directory # copy file [root@taoyuan etc] # cp / usr/local/src/php-5.6.30/php.ini-production / usr/local/php-fpm/etc/php.ini/usr/local/php-fpm/sbin/php-fpm # is used to start the php-fpm service # use the parameter-M-I-t to test the configuration file syntax / usr/local/php -fpm/var/ # log storage log run storage PID# configuration service cp php.ini-production / usr/local/php-fpm/etc/php.ini#development suitable for use in development environment # prodution suitable for actual production environment to modify configuration file # create new php-fpm.conf [root@taoyuan etc] # vim php-fpm.conf#php-fpm.conf content as follows: [global] pid = / usr/local/php-fpm/var / run/php-fpm.piderror_log = / usr/local/php-fpm/var/log/php- fpm.log [www] listen = / tmp/php-fcgi.socklisten.mode = 666user = php-fpmgroup = php-fpmpm = dynamicpm.max_children = 20pm.min_spare_servers = 5pm.max_spare_servers = 35pm.max_requests = 500rlimit_files = 1024 copy of the startup script [root@taoyuan etc] # cp / usr/local/src/php-5.6 . 30/sapi/fpm/init.d.php-fpm / etc/init.d/php-fpm setup boot # set permissions [root@taoyuan etc] # chmod 755 / etc/init.d/php-fpm# join the service [root@taoyuan etc] # chkconfig-- add php-fpm# add user [root@taoyuan etc] # useradd php-fpm# startup service [root@taoyuan etc] # service php-fpm startStarting php-fpm done12.5 Nginx introduction

Nginx is a lightweight Web cloud server / reverse proxy server and email (IMAP/POP3) proxy server, and is distributed under a BSD-like protocol. It is characterized by low memory and strong concurrency ability. in fact, the concurrency ability of nginx does perform well in the same type of web server. Chinese mainland uses nginx website users: Baidu, JD.com, Sina, NetEase, Tencent, Taobao and so on.

Nginx official website nginx.org, the latest version 1.13, the latest stable version of 1.12Nginx application scenarios: web service, reverse proxy, load balancing Nginx famous branch, Taobao based on Nginx development of Tengine, use the same as Nginx, service name, configuration file name are the same, the biggest difference with Nginx is that Tenging added some customized modules, outstanding performance in security speed limit, in addition, it supports js Css combined to see the above LNMP architecture, Nginx introduction and MySQL, PHP installation tutorial introduction, hoping to give you some help in practical application. Due to the limited space in this article, there will inevitably be deficiencies and areas that need to be supplemented. You can continue to pay attention to the industry information section and will update your industry news and knowledge regularly. If you need more professional answers, you can contact us on the official website for 24-hour pre-sales and after-sales to help you answer questions at any time.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report