In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
3 hosts of LNMP are separated for deployment
First virtual host for deployment nginx second virtual host for deployment php-fpm third virtual host for deployment of mariadb-server
Installation of deployment nginx on the first host: processing of static web pages (192.168.1.107)
1. Download version 1.8 first, and then decompress it.
two。 Compile and install as follows
3.yum groupinstall "Development Tools"Server Platform Development"-y
Yum-y install openssl-devel pcre-devel zlib-devel
Useradd-r nginx
4. Create an environment
/ configure-- prefix=/usr/local/nginx-- conf-path=/etc/nginx/nginx.conf-- user=nginx-- group=nginx-- error-log-path=/var/log/nginx/error.log-- http-log-path=/var/log/nginx/access.log-- pid-path=/var/run/nginx/nginx.pid-- lock-path=/var/lock/nginx.lock-- with-http_ssl_module-- with-http_gzip_static_module-- with-debug-- with-http_stub_status_module
5. Carry out compilation work
Make & & make install
6. [root@localhost nginx] # / usr/local/nginx/sbin/nginx-t check whether the syntax is correct
Nginx: the configuration file / etc/nginx/nginx.conf syntax is ok
Nginx: configuration file / etc/nginx/nginx.conf test is successful
7./usr/local/nginx/sbin/nginx Startup Service
8. The tests are as follows
9. Modify its commands and edit the configuration file
[root@localhost ~] # vim / etc/profile.d/nginx.sh
Export PATH=/usr/local/nginx/sbin:$PATH
Exec bash / etc/profile.d/nginx.sh
[root@localhost ~] # echo $PATH
/ usr/local/nginx/sbin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
Nginx-t test the grammar
Nginx-s reload reload
10. Start nginx to view port 80 cd / usr/local/nginx
Then execute nginx and use the command ss-tnl to see if the port is enabled.
11. Define the configuration file of nginx vim / etc/nginx/nginx.conf
Server {
Listen 80
Server_name www.magedu.com
# charset koi8-r
# access_log logs/host.access.log main
Location / {
Root html/wordpress
Index index.html index.htm
}
Location ~\ .php$ {
Root html
Fastcgi_pass 192.168.1.109:9000
Fastcgi_index index.php
Fastcgi_param SCRIPT_FILENAME / var/www/html/wordpress/scripts$fastcgi_script_name
Include fastcgi_params
}
twelve。 Reload the configuration file nginx-t nginx-s reload
13 whether the stand-alone Nginx service can be accessed normally, if not, its selinux must be turned off, and the firewall must turn off ok.
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.
Source: http://192.168.1.107/ can be accessed normally, no more problems, and then test the following services.
The second virtual host installs php-fpm (192.168.1.100)
1.yum install php-fpm-y yum install php-mbstring yum install php-mysql
Then start the service service php-fpm start
Check to see that the listening port defaults to 127.0.0.1virtual 9000 and changed to 192.168.1.100plu9000.
two。 Edit the configuration file vim / etc/php-fpm.d/www.conf
Listen.allowed_clients = 192.168.1.107 here is the IP address of Nginx's virtual machine, that is, the IP of the first virtual machine.
Listen = 192.168.1.100 9000
3. Restart the service service php-fpm restart
The third virtual host installs the mariadb-server database (192.168.1.109)
1. Then start the service service mysqld start to listen to the port number is 3306 ssl-tnlp to check
[root@localhost ~] # ss-tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 50 *: 3306 *: *
two。 Set up the data name, and open the permitted network to connect to the database.
Mysql carries on the database
MariaDB [(none)] > GRANT ALL ON *. * TO root@'192.168.%.%' IDENTIFIED BY 'root'; allows hosts of this network segment to access any database
Query OK, 0 rows affected (0.00 sec)
Name of the database created by MariaDB [(none)] > CREATE DATABASE rootdb;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)] > FLUSH PRIVILEGES; takes effect immediately
Query OK, 0 rows affected (0.00 sec)
3. You can test the database.
You can install the database of the virtual machine, and then test the data of the virtual machine 3. If you can log in, there is no problem. Command mysql-uroot-h292.168.1.109-proot
After the test is completed, the database is closed and OK is done.
4. Then upload its software wordpress to / usr/local/nginx/html/ of virtual machine 1 and / var/www/html of virtual machine 2 respectively
Provide php-fpm virtual machine host creation directory mkdir-pv / var/www/html in 192.168.1.100
Then copy the software to this directory and edit the configuration file of the software vim config.php
There are two items that need to be modified: $cfg ['blowfish_secret'] =' 68max w1KBacRDOtUniple pTgbBOBODN; the red area is where the password is set using the command openssl rand-base64 15
An encrypted key will be generated and pasted in the red area. $cfg ['Servers'] [$I] [' host'] = '192.168.1.109address; this IP address is written to the IP address of the host where the database is located. Ok
Similarly, upload its software to a nginx server that provides static services, and put it under / usr/local/nginx/html/.
5. Now you can test the services provided by the second virtual host, through the first virtual host, to see if it can be forwarded to the second, as shown below; to see if the test page provided by the second can be displayed.
6. Then the next step is to connect to the database provided by the third virtual host. If it can be linked normally, the phpMyAdmin software we edited should display the login interface. All right, let's test it. The login screen has been displayed, indicating that our LNMP has been built successfully.
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.