Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build a LEMP environment in Docker

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to build a LEMP environment in Docker. Xiaobian thinks it is very practical, so share it with everyone. I hope you can gain something after reading this article. Let's not say much. Let's take a look at it with Xiaobian.

LEMP (Linux + Nginx + MySQL + PHP) is basically a must-have environment for web developers today. Under normal circumstances, we can install and use it directly through system package management tools such as apt and yum. However, due to compatibility considerations, the software source that comes with the system is often updated slowly, and it will stagnate in the previous version in about half a year, affecting developers 'follow-up testing of new features.

In order to pursue the latest version, many developers began to download the source package to compile themselves, but the process was too cumbersome, and later catalyzed a one-click installation package like Oneinstack, lamp.sh, etc.

Docker's launch can greatly simplify the above process. On Docker Hub, many maintainers package php, nginx and other components into images, and users can build LEMP by pulling the associated images. And Docker-based features bring at least the following advantages:

Update quickly, roll back specified versions at any time

Container isolation, high safety

No system residues, no dependency chain conflicts

container

container name Version metowolf/php7.3.1, 7.3, 7, currentmetowolf/nginx1.15.8, 1.15, 1, currentmysql/mysql-server8.0.15phpmyadmin/phpmyadmin4.8.5abiosoft/caddy0.11.2redis5.0.3-alpine

demo

Let me give you a simple example.

First you need to install docker and docker-compose environments. For the sake of demonstration, PWD's trial host is used directly here.

$ curl -fsSL https://get.docker.com -o get-docker.sh$ sh get-docker.sh$ curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose$ chmod +x /usr/local/bin/docker-compose

Log in to the server and pull the layout template

$ git clone https://github.com/metowolf/docker-lemp.git$ cd docker-lemp

create a profile

$ cp .env.example .env$ cp docker-compose.example.yml docker-compose.yml

Create nginx configuration

$ cat > etc/nginx/config/example.conf

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report