LNMP is a dynamic website server architecture built by combining Nginx, Mariadb and PHP under Linux system. Next, we use Docker to create a distributed lnmp image. 1. Docker distributed lnmp image production1. Run Nginx, MySQL, and PHP containers#Turn off the firewall and core protection systemctl disable firewalld systemctl stop firewalld setenforce 0 # Check whether ports 3306, 80, and 9000 are occupied ss -natp | grep 3306 ss -natp | grep 80 ss -natp | grep 9000 #Create a custom network docker network create -d bridge --subnet 172.168.184.0/24 --gateway 172.168.184.1 lnmp #Run the Nginx container docker run -itd --name nginx --network lnmp -p 80:80 --ip 172.168.184.10 nginx:1.12.0 #Run the MySQL container docker run -itd --name mysql --network lnmp -p 3306:3306 --ip 172.168.184.20 -e MYSQL_ROOT_PASSWORD=010230 mysql:5.7 #Run the PHP container docker run -itd --name phpfpm --network lnmp -p 9000:9000 --ip 172.168.184.30 php:7.1-fpm 2. Modify Nginx configuration file and PHP filedocker exec -it nginx /bin/bash echo -e "server { listen 80; server_name localhost; location / { root /usr/share/nginx/html; index index.html index.htmi index.php; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { root /usr/share/nginx/html; fastcgi_pass 172.168.184.30:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name; include fastcgi_params; } }" > /etc/nginx/conf.d/default.conf nginx -s reload docker exec -it phpfpm /bin/bash mkdir -p /usr/share/nginx/html echo "<?php phpinfo(); ?>" > /usr/share/nginx/html/index.php 4. Conduct testingEnter localhost/index.php in the virtual machine Enter 192.168.184.70/index.php on this machine (my virtual machine address is 192.168.184.70) The above is the details of using docker to create a distributed lnmp image. For more information about docker distributed lnmp images, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: What does href=# mean in a link?
>>: Detailed tutorial on installation and configuration of compressed version of MySQL database
Table of contents First install wget View Help Ma...
1. Brief introduction of the event An event is a ...
Recently I have used the function of renaming sto...
Preface There are many open source monitoring too...
1. First of all, we need to distinguish between t...
This article shares the specific code of JS+Canva...
Solution 1: Use conditional import in HTML docume...
Install boost There are many ways to call C/C++ f...
Edit /etc/docker/daemon.json and add the followin...
Today, I fell into the trap again. I have encount...
Preface Since many friends say they don’t have Ma...
I've been playing with the remote development...
1. What is Continuous Delivery The software produ...
MySQL 5.7.17, now seems to be the latest version,...
This article shares with you how to install the M...