In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The following content mainly brings you installation details such as LNMP architecture and mysql. The knowledge mentioned here, which is slightly different from books, is summarized by professional and technical personnel in the process of contact with users, and has a certain value of experience sharing. I hope to bring help to the majority of readers.
I. introduction to the construction of LNMP
Unlike LAMP, the web service is provided by Nginx
And php exists as a stand-alone service called php-fpm
Nginx handles static file requests directly, and dynamic requests are forwarded to php-fpm
The difference between apache and nginx; https://www.cnblogs.com/huangye-dream/p/3550328.html
Advantages of nginx over apache:
Lightweight, also a web service, takes up less memory and resources than apache
Anti-concurrency, nginx processes requests asynchronously and non-blocking, while apache is blocking. Under high concurrency, nginx can maintain low resources, low consumption and high performance.
Highly modular design, relatively simple to write modules
The community is active and all kinds of high-performance modules are produced quickly.
Advantages of apache over nginx:
Rewrite is more powerful than nginx's rewrite.
There are so many modules that you can find anything you can think of.
Less bug, more bug in nginx
Asynchronous and synchronous:
Synchronization: you call the bookstore owner to ask if there is a "distributed system". If it is a synchronous communication mechanism, the bookstore owner will say, wait a moment, "I'll check", and then start checking and checking, and when it's done (maybe 5 seconds. It could be a day) to let you know the result (return result).
Async: the bookstore owner directly told you that I would check it out, call you when it was done, and then hang up directly (no results are returned). Then check it out, he will take the initiative to call you. Here the boss callback through "call back" this way.
Blocking and non-blocking:
You call the bookstore owner to ask if there is a book called "distributed system". If you make a blocking call, you will "suspend" yourself until you get the result of the book. If it is a non-blocking call, no matter whether the boss tells you or not, you will go and play by yourself. Of course, you have to check every once in a while to see if the boss has returned the result or not.
Here blocking and non-blocking have nothing to do with synchronization and asynchronism. It has nothing to do with the way the boss answers you.
II. Installation of mysql
[root@lnmp mysql] # cd / usr/local/src/
[root@lnmp mysql] # wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
[root@lnmp mysql] # tar zxvf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz (extract mysql tar package)
[root@lnmp mysql] # mv mysql-5.6.36-linux-glibc2.5-x86_64 / usr/local/mysql (Mobile decompressed package and renamed)
[root@lnmp mysql] # mkdir / data (create a stored / data directory)
[root@lnmp mysql] # useradd mysql (create mysql user)
[root@lnmp mysql] # vim / etc/my.cnf (modify / etc/my.cnf file)
Datadir=/data/mysql
Socket=/tmp/mysql.sock
[root@lnmp mysql] # / scripts/mysql_install_db-- user=mysql-- datadir=/data/mysql
(initialize MySQL and specify the user and database directory. An error will be reported during the first installation. Install the following 2 packages.)
[root@lnmp mysql] # yum install autoconf-y
[root@lnmp mysql] # yum install-y libaio
[root@lnmp mysql] # / scripts/mysql_install_db-- user=mysql-- datadir=/data/mysql
[root@lnmp mysql] # cp support-files/mysql.server / etc/init.d/mysqld (replication startup script)
[root@lnmp mysql] # vim / etc/init.d/mysqld (modify basedir and datadir in startup script)
46 basedir=/usr/local/mysql
47 datadir=/data/mysql
[root@lnmp mysql] # / etc/init.d/mysqld start (start mysql)
[root@lnmp mysql] # chkconfig-- add mysqld (add mysql to service list)
[root@lnmp mysql] # chkconfig mysqld on (set MySQL to boot)
Once added to the list of services, you can use the following command:
[root@lnmp mysql] # service mysqld stop (start MySQL)
Shutting down MySQL.. SUCCESS!
[root@lnmp mysql] # service mysqld start (close MySQL)
Starting MySQL. SUCCESS!
III. PHP installation
[root@lnmp ~] # cd / usr/local/src (download the source package to the specified directory)
[root@lnmp ~] # wget http://cn2.php.net/distributions/php-5.6.30.tar.gz
[root@lnmp ~] # tar zxf php-5.6.30.tar.gz
[root@lnmp ~] # useradd-s / sbin/nologin php-fpm (add php-fpm users,-s specifies that you cannot log in)
[root@lnmp ~] # cd php-5.6.30
[root@lnmp] # / 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
(compilation of php packages, there may be packages that need to be installed, resulting in errors)
[root@lnmp] # make & & make install
[root@lnmp ~] # cp php.ini-production / usr/local/php-fpm/etc/php.ini (copy directory and change name)
[root@lnmp ~] # vi / usr/local/php/etc/php-fpm.conf (modify php configuration file, following)
[global] define global parameters
Pid = / usr/local/php-fpm/var/run/php-fpm.pid
Error_log = / usr/local/php-fpm/var/log/php-fpm.log
[www] the name of a module
Listen = / address of tmp/php-fcgi.sock listener
Listen.mode = 666 defines permissions for sock files
User = php-fpm user
Group = php-fpm user group
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@lnmp ~] # cp sapi/fpm/init.d.php-fpm / etc/init.d/php-fpm (copy startup script to the following location)
[root@lnmp ~] # chmod 755 / etc/init.d/php-fpm
[root@lnmp ~] # chkconfig-- add php-fpm (add php to service)
[root@lnmp ~] # chkconfig php-fpm on (set boot to start the php service)
[root@lnmp ~] # service php-fpm start (start php service)
IV. Introduction of nginx
Nginx official website nginx.org, latest version 1.13, latest stable version 1.12
Nginx application scenarios: web service, reverse proxy, load balancing
The famous branch of Nginx, Tengine developed by Taobao based on Nginx, has the same use as Nginx, service name and configuration file name. The biggest difference from Nginx is that Tenging adds some customized modules, which is outstanding in terms of security and speed limit. In addition, it supports merging of js,css.
Nginx core + lua related components and modules form a high performance web container openresty that supports lua
For the above details about LNMP architecture and mysql installation, if you need to know more, you can continue to pay attention to the innovation of our industry. If you need professional answers, you can contact the pre-sales and after-sales on the official website. I hope this article can bring you some knowledge updates.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.