In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Apache and LNMP architecture do static and dynamic separation
The static processing capacity of nginx is very strong, but the dynamic processing capacity is insufficient, so it is necessary to give the dynamic page to Apache to achieve the separation of dynamic and static.
Install apache service [root@localhost ~] # yum install httpd httpd-devel-y # # install apacher package [root@localhost ~] # systemctl start httpd.service # # enable service [root@localhost ~] # firewall-cmd-- permanent-- zone=public-- add-service=http # permanently allow http service success [root@localhost ~] # firewall-cmd-- permanent-- zone=public-- add-service=https # permanently allow https service success [root@localhost ~] # firewall-cmd-- reload # # reload the firewall success and go to the client to test whether you can access the apache website
Install LNMP architecture (easy to install)
MariaDB database management system is a branch of MySQL and is mainly maintained by the open source community. The purpose of licensing MariaDB with GPL is to be fully compatible with MySQL, including API and the command line, making it an easy replacement for MySQL. In terms of storage engine, XtraDB (English: XtraDB) is used instead of MySQL's InnoDB. MariaDB was developed by Michael Widenius (English: Michael Widenius), the founder of MySQL, who earlier sold his company, MySQL AB, to SUN for $1 billion. Since then, with the acquisition of SUN by Oracle, the ownership of MySQL has also fallen into Oracle's hands. The name MariaDB comes from the name of Michael Widenius's daughter Maria.
Install database yum install mariadb mariadb-server mariadb-libs mariadb-devel-y # install database component [root@localhost ~] # systemctl start mariadb [root@localhost ~] # netstat-natap | grep 3306tcp 00 0.0.0.0 systemctl start mariadb 3306 0.0.0.0 systemctl start mariadb * LISTEN 15154/mysqld configuration database [root@localhost ~] # mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!In order to log into MariaDB to secure it, we'll need the currentpassword for the root user. If you've just installed MariaDB, andyou haven't set the root password yet, the password will be blank,so you should just press enter here.Enter current password for root (enter for none): # # Press enter Set root password? Do you want to set the password New password: # enter your password Re-enter new password: Remove anonymous users? Do you want to delete anonymous users and not delete Disallow root login remotely? [YPop] n # # do you want root users to log in to Remove test database and access to it remotely? Do you want to delete the test database Reload privilege tables now? [Yapin] var/www/htmlvim index.php # whether to load the attribute list inside and install PHPyum-y install php## to establish the association between php and mysql yum install php-mysql-y contacts # install the php plug-in yum install-y php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel php-bcmathcd / var/www/htmlvim index.php # # write on the PHP web page [root@localhost html] # systemctl restart httpd.service customer Go to the computer to test whether you can access PHP.
Open another Linux as Nginx to handle static requests [root@localhost ~] # yum install pcre-devel zlib-devel gcc gcc-c++-y # # installation environment package [root@localhost] # useradd-M-s / sbin/nologin nginx # # create a programmatic user [root@localhost] # mkdir / chen # # create a mount point [root@localhost] # mount.cifs / / 192.168.100.23/LNMP / chen # # mount Password for root@//192 .168.100.23 / LNMP: [root@localhost chen] # tar zxvf nginx-1.12.2.tar.gz-C / opt/ # # decompress [root@localhost chen] # cd / opt/ [root@localhost opt] # lsnginx-1.12.2 rh [root@localhost opt] # cd nginx-1.12.2/ [root@localhost nginx-1.12.2] # lsauto CHANGES.ru configure html man srcCHANGES conf contrib LICENSE README./configure \ # # install component-- prefix=/usr/local/nginx\ # # specify path-- user=nginx\ # # specify user-- group=nginx\ # # specify group-- with-http_stub_status_module # # status statistics module [root@localhost nginx-1.12.2] # make & & make install # # compile [root@localhost nginx-1.12.2] # ln-s / usr/local/nginx/sbin/nginx / usr/local/ Sbin/ # # soft connection [root@localhost nginx-1.12.2] # nginx- t # # check syntax nginx: the configuration file / usr/local/nginx/conf/nginx.conf syntax is oknginx: configuration file / usr/local/nginx/conf/nginx.conf test is successful write nginx script in system startup script to facilitate service manager to manage [root@localhost nginx-1.12.2] # cd / etc/init.d/ [root@localhost init.d] # vim nginx #! / bin/bash#chkconfig:-99 20 # comment Information # description: Nginx Service Control ScriptPROG= "/ usr/local/nginx/sbin/nginx" # this variable Point to my command file PIDF= "/ usr/local/nginx/logs/nginx.pid" # this variable, and point to the nginx process number case "$1" in start) $PROG ; stop) kill-s QUIT $(cat $PIDF);; restart) $0 stop $0 start;; reload) kill-s HUP $(cat $PIDF) *) echo "Usage: $0 {start | stop | restart | reload}" exit 1esacexit 0 enable the service And test whether the web page is valid [root@localhost init.d] # chmod + x nginx [root@localhost init.d] # chkconfig-- add nginx [root@localhost init.d] # service nginx start [root@localhost init.d] # netstat-ntap | grep nginx tcp 00 0.0.0.0nginx 80 0.0.0.0 ntap * LISTEN 17544/nginx: master [root@localhost init.d] # systemctl stop Firewalld.service [root@localhost init.d] # setenforce 0 [root@localhost init.d] # yum install elinks-y [root@localhost init.d] # elinks http://192.168.136.162/ # # Test whether the website is in effect
Send dynamic requests to Apache for processing in the nginx configuration file, 174The server [root@localhost init.d] # vim / usr/local/nginx/conf/nginx.conf 59 location ~\ .php$ {60 proxy_pass http://192.168.136.174; # # in the sever area, change the address and transfer the dynamic request to 174. process 61} [root@localhost init.d] # service nginx stop [root@localhost init.d] # service nginx start to the client to test dynamic and static requests, and enter 192.168.136.174/index.php
Enter 192.168.136.174/index.html
Thanks for watching
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.