In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, the editor will share with you the relevant knowledge points about how to deploy the LNMP server environment in Docker. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article.
Download the image [root@localhost ~] # docker pull nginx [root@localhost ~] # docker pull mysql [root@localhost ~] # docker pull php:7.1.0-fpm to write the script to generate the nginx container [root@localhost ~] # vim dockerroomnginx.shystroke * env bashdocker run-p 80:80-name nginx\-v / docker/code:/usr/share/nginx/html\-v / var/log/nginx:/var/log/nginx\-v / docker / nginx/conf.d:/etc/nginx/conf.d\-- privileged=true\-d nginx [root@localhost ~] # shdocker _ nginx.sh3e9cd3d3b97c7e5ca001b30b5905c02c616fc48a81d14f716e3242d181ce2b31 write the script to generate php container [root@localhost ~] # vim dockerkeeper php.shallows! / usr/bin bashdocker run-p 9000Php 9000-name php\-v / docker/code/:/var/www/html/\-privileged=true\-d php:7.1.0-fpm [root@localhost ~] # shdocker _ php .sh754a8c8c860fb3650a92e011ebae9d0575209c96a429411099d143f36cc1a435 write a script to generate a mysql container [root@localhost ~] # vim docker_mysql.sh# / usr/bin bashdocker run-- container name created by name mysql\ # set mysql password-v / usr/lib/mysql:/usr/lib/mysql\-p 3306 display 3306\ # Port 3306 of the container is mapped to the host machine-d mysql # background running container [root@localhost ~] # sh docker_mysql.sh63362a2f5744f962c7de19894e87624fa24579a3ca0177113f6703c8b2093250 create project folder and nginx configuration [root@localhost ~] # mkdir / docker/codemkdir: cannot create directory "/ docker/code": file already exists [root@localhost ~] # mkdir / docker/nginx/conf.dmkdir: unable to create directory "/ docker/nginx/conf.d": file already exists [root@localhost ~] # vim / docker/ Nginx/conf.d/default.confserver {listen 80 default_server Server_name localhost; root / usr/share/nginx/html/; location / {index index.html index.htm index.php; autoindex off;} location ~\ .php (. *) ${root / var/www/html/; fastcgi_pass 172.17.0.3 location 9000; fastcgi_index index.php; fastcgi_split_path_info ^ ((? U). +\ .php) (/?. +) $; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name Fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params;}} restart the Nginx container [root@localhost ~] # docker restart nginxnginx to detect
Create an index file
[root@localhost ~] # echo "" > / docker/code/index.php
Test, appears after success
The php image, excluding the pdo_mysql extension, needs to be installed by yourself. The installation method is as follows
Docker exec-it php bashapt-get-y updateapt-get install-y libpng12-dev libjpeg-dev libpq-dev libxml2-devdocker-php-ext-install pdo_mysql pdo_pgsql if you want to use redis extension pecl install redis-3.1.1docker-php-ext-enable redis to enter the container bash and enter the mysql command line [root@localhost docker] # docker exec-it mysql bashroot@63362a2f5744:/# mysql-uroot-p lujunwendocker container mysqlMyslq setting password method 2
Docker run-name mysql-p 3306 mysql 3306-e MYSQL_ROOT_PASSWORD=admin-d mysql
These are all the contents of the article "how to deploy a LNMP server environment in Docker". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
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.