In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to build and deploy LNMP platform environment". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to build and deploy LNMP platform environment".
What is LNMP
LNMP refers to a group of free software acronyms that are usually used together to run dynamic websites or servers. L refers to Nginx,M generally refers to MySQL, can also refer to MariaDB,P generally refers to PHP, can also refer to Perl or Python.
LNMP represents the web server architecture of Nginx+MySQL+PHP under the Linux system.
Linux is a kind of Unix computer operating system, which is the most popular free operating system at present. Representative versions are: debian, centos, ubuntu, fedora, gentoo, etc.
Nginx is a high-performance HTTP and reverse proxy server, as well as an IMAP/POP3/SMTP proxy server
Mysql is a small relational database management system. For MariaDB on Linux
PHP is a scripting language that embeds HTML documents executed on the server side
These four kinds of software are all free and open source software, which are combined into a free, efficient and scalable website service system.
2. The overall process of deploying the LNMP environment
1. Install and deploy Nginx, MariaDB, PHP, PHP-FPM
two。 Start Nginx, MariaDB, FPM services
3. Test if LNMP is working properly.
Required software package
1.Nginx:nginx-1.17.4
2.MySQL:mariadb 、 mariadb-server 、 mariadb-devel
3.PHP:php 、 php-fpm 、 php-mysql
Description: mariadb (database client software), mariadb-server (database server software), mariadb-devel (dependency package of other client software), php (interpreter), php-fpm (process manager service), php-mysql (database expansion package of PHP)
Use yum to install all the required software packages, Nginx we use compilation to install
[root@centos7~] # yum-y install php php-mysql php-fpm
[root@centos7~] # system restart php-fpm
[root@centos7~] # system enable php-fpm
[root@centos7~] # yum-y install mariadb mariadb-server mariadb-devel
[root@centos7~] # systemctl restart mariadb
[root@centos7~] # systemctl enable mariadb
[root@centos7~] # wget http://nginx.org/download/nginx-1.17.4.tar.gz
[root@centos7~] # useradd-s / sbin/nologin nginx
[root@centos7~] # tar-xvf nginx-1.17.4.tar.gz
[root@centos7~] # cd nginx-1.17.4
[root@centos7 nginx-1.17.4] #. / configure-- user=nginx-- group=nginx-- with-http_ssl_module / / compilation installation package
[root@centos7~] # make & & make install
[root@centos7~] # / usr/local/nginx/sbin/nginx
[root@centos7~] # ln-s / usr/local/nginx/sbin/nginx
[root@centos7~] # nginx-s reload
[root@centos7~] # yum-y install php php-mysql php-fpm / / install PHP-FPM
[root@centos7~] # system restart php-fpm
[root@centos7~] # system enable php-fpm
[root@centos7~] # yum-y install mariadb mariadb-server mariadb-devel / / install MySQL
[root@centos7~] # systemctl restart mariadb
[root@centos7~] # systemctl enable mariadb
# so far, all the software packages have been installed #
Third, the construction and configuration of the platform. Configure PHP
Configure Fast-CGI to support PHP web pages and test whether PHP connects to the database successfully
Root@centos7 ~] # vim / usr/local/nginx/html/test.php
two。 Modify the Nginx profile and start the service
[root@centos7 ~] # vim / usr/local/nginx/conf/nginx.conf / / only part of the configuration is retained here
User nginx nginx
Worker_processes 1
Error_log logs/error.log
Error_log logs/error.log notice
Pid logs/nginx.pid
Events {
Worker_connections 1024
}
Http {
Include mime.types
Default_type application/octet-stream
Access_log logs/access.log main
Sendfile on
Keepalive_timeout 65
Server {
Listen 80
Server_name www.cc.com
Location / {
Root html
Index index.php index.html index.htm
}
Return 301https://$server_name$request_uri; / / set mandatory redirect HTTPS access
Error_page 500 502 503 504 / 50x.html
Location = / 50x.html {
Root html
}
}
# HTTPS server / / enable https service
Server {
Listen 443 ssl
Server_name www.cc.com
Ssl_certificate cert.pem
Ssl_certificate_key cert.key
Ssl_session_cache shared:SSL:1m
Ssl_session_timeout 5m
Ssl_ciphers HIGH:!aNULL:!MD5
Ssl_prefer_server_ciphers on
Location / {
Root html
Index index.html index.htm
}
# configure php
Location ~\ .php$ {
Root html
Fastcgi_pass 127.0.0.1:9000
Fastcgi_index index.php
Fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name
Include fastcgi.conf
}
}
}
[root@centos7 ~] # nginx-s reload / / restart nginx
Locally bind hosts files to access the test php page
Thank you for your reading, the above is the content of "how to build and deploy the LNMP platform environment". After the study of this article, I believe you have a deeper understanding of how to build and deploy the LNMP platform environment. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.