In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to build a php development environment for win10 docker-toolsbox. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Download the image
Docker pull mysql:5.7 docker pull php:7.2-fpmdocker pull nginxdocker pull redis:3.2
Set up shared files
Host create directory
E:\ wnmp\ mysql57\ confE:\ wnmp\ mysql57\ logE:\ wnmp\ php72\ confE:\ wnmp\ php72\ confE:\ wnmp\ nginx\ confE:\ wnmp\ nginx\ confE:\ wnmp\ www
Vmware Settings File sharing
As shown in the picture
Set up to execute docker-machine restart default in Docker Quickstart Termina
Install Mysql
Docker run-d-p 3306 name mysql57 mysql:5.7 3306-e MYSQL_ROOT_PASSWORD=root
Copy Profil
PS C:\ Windows\ system32 > docker cp mysql57:/var/log/mysql E:\ wnmp\ mysql57\ logPS C:\ Windows\ system32 > docker cp mysql57:/etc/mysql E:\ wnmp\ mysql57\ conf
Reinstall mysql and specify the configuration file
PS C:\ WINDOWS\ system32 > docker stop mysql57mysql57PS C:\ WINDOWS\ system32 > docker rm mysql57mysql57PS C:\ WINDOWS\ system32 > docker run-d-v / wnmp/mysql57/log:/var/log/mysql/-v / wnmp/mysql57/conf:/etc/mysql/-p 3306-e MYSQL_ROOT_PASSWORD=root-- name mysql57mysql: 5.7
Initialize the database
Docker exec-ti mysql57 / bin/bashmysql_secure_installation # View Mysql status root@d7bd0712bcf8:/# mysql-uroot-prootmysql: [Warning] Using a password on the command line interface can be insecure.Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 6Server version: 5.7.28 MySQL Community Server (GPL) Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
Install PHP
PS C:\ WINDOWS\ system32 > docker run-d-v / wnmp/www:/var/www/html-p 9000 docker run-- link mysql57:mysql-- name php72 php:7.2-fpm
Copy Profil
PS C:\ Windows\ system32 > docker cp php72:/usr/local/etc E:\ wnmp\ php72\ confPS C:\ Windows\ system32 > docker cp php72:/usr/local/var/log E:\ wnmp\ php72\ logPS C:\ Windows\ system32 > docker cp php72:/var/www/html E:\ wnmp\ www
Reinstall PHP and specify the configuration file
PS C:\ WINDOWS\ system32 > docker stop php72php72PS C:\ WINDOWS\ system32 > docker rm php72php72docker run-d-v / wnmp/php72/conf/etc:/usr/local/etc-v / wnmp/php72/log:/usr/local/var/log-v / wnmp/www:/var/www/html-p 9000 link mysql57:mysql-- name php72php: 7.2-fpm# View PHP version PS C:\ Windows\ system32 > docker exec-ti php72/ bin/bashroot@742150f14d8a:/var/ Www/html# php-vPHP 7.2.23 (cli) (built: Oct 5 2019 00:31:47) (NTS) Copyright (c) 1997-2018 The PHP GroupZend Engine v3.2.0 Copyright (c) 1998-2018 Zend TechnologiesNgixn
Installation
PS C:\ WINDOWS\ system32 > docker run-d-p 80:80-- link php72:phpfpm-- name nginx nginx:latest
Copy Profil
PS C:\ Windows\ system32 > docker cp nginx:/etc/nginx/ E:\ wnmp\ nginx\ confPS C:\ Windows\ system32 > docker cp nginx:/var/log/nginx/ E:\ wnmp\ nginx\ log
Reinstall and specify the configuration file
PS C:\ WINDOWS\ system32 > docker stop nginxnginxPS C:\ WINDOWS\ system32 > docker rm nginxnginxPS C:\ WINDOWS\ system32 > docker run-d-p 80:80-v / wnmp/www:/var/www/html-v / wnmp/nginx/conf/nginx:/etc/nginx/-v / wnmp/nginx/log:/var/log/nginx/-- link php72:phpfpm-- name nginxnginx # browser accesses http://192.168.99.100/ successfully Redisdocker run-p 63796379-d redis:3.2 redis-server
PHP extension installation
RedisPS C:\ Windows\ system32 > docker exec-ti php72 / bin/bashroot@742150f14d8a:/var/www/html# pecl install-o-f redis# installation is complete. Join the Ini configuration. The redis configuration under docker is located at E:\ wnmp\ php72\ conf\ etc\ php\ conf.d\ docker-php-ext-sodium.ini# to restart php.
Configure the test domain name
# E:\ wnmp\ nginx\ conf\ nginx\ conf.d directory create a new test.conf#E:\ wnmp\ www directory, create a new test directory. Create a new index.php output phpinfo under the Server {listen 80; server_name test.com; # charset koi8-r; access_log / var/log/nginx/host.access.log main; location / {root / var/www/html/test; index index.php index.html index.htm;} # error_page 404 / 404.html; # redirect server error pages to the static page / 50x.html # error_page 500 502 503 504 / 50x.html Location = / 50x.html {root / usr/share/nginx/html;} # proxy the PHP scripts to Apache listening on 127.0.0.1 php$ 80 # # location ~. Php$ {# proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1 location ~. Php$ {root / var/www/html/test; fastcgi_pass 192.168.99.100 Fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\ .ht {deny all;}} # nginx reload the configuration or restart. # Local host resolution domain name test.com access shows that phpinfo is normal
The above are all installation configurations and tests. Of course, in the end, we need to add these docker containers to the automatic startup.
Docker container update-restart=always php72docker container update-restart=always mysql57docker container update-restart=always nginxdocker container update-restart=always redis article on "how to build a php development environment for win10 docker-toolsbox" ends here. I hope the above content can be helpful to you, so that you can learn more knowledge. If you think the article is good, please share it for more people to see.
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.