docker-lnmp-with-mutli-php-versions

(中文版说明)

Because of my work needs, I need to maintain somw old system which use php5.3, so I need a more rapid deployment system tools. And that's what I going to share with you.

Create the LNMP with Docker (Use the php5.3, 5.6, 7.2 to deployment is available)

+- - - - - - - - - - - - - - - - - - - - - - - -+ ' docker: ' ' ' +------+ 80 ' +-------+ 9000 +-----------+ ' | | ------> ' | | <------> | PHP-FPM53 | <------+ ' | | ' | | +-----------+ | ' | | ' | | 9000 +-----------+ | ' | | ' | | <------> | PHP-FPM56 | <------+ ' | | ' | Nginx | +-----------+ | ' | User | ' | | 9000 +-----------+ | ' | | ' | | <------> | PHP-FPM72 | <------+ ' | | ' | | +-----------+ | ' | | ' | | | ' | | ' +-------+ | ' | | 3306 ' +-------+ 3306 | ' | | ------> ' | Mysql | <-----------------------------+ ' +------+ ' +-------+ ' ' ' +- - - - - - - - - - - - - - - - - - - - - - - -+

Feature

Multiple PHP version can be one-time deployment. All Configuration/Log files are stored in the host. MySQL Data are stored in the host.

Requirement

Git Docker (Install) Docker-Compose(Install)

Deploy

Clone Project:

$ git clone https://github.com/copriwolf/docker-lnmp-with-mutli-php-versions.git Go into the project & Start docker compose:

$ cd docker-lnmp-with-mutli-php-versions $ docker-compose up Check the URL localhost in you browser, and you will catch the phpinfo with 7.2:

the php7.2 site files is in ./site/site1

Preview other php version website?

You can add these hosts in your system.

hosts file location: Linux & Mac in /etc/hosts, Windows in C:WindowsSystem32driversetc (default)

127.0.0.1 www.site1.com 127.0.0.1 www.site2.com 127.0.0.1 www.site3.com Then go to your browser and type www.site2.com or www.site3.com, you will catch the php5.6 & php5.3.

Create a php53/php56/php72 website?

In fact I am using the Nginx conf file to control the version of PHP. You can check the .conf/nginx/conf.d/site1.conf, and found I fill the fpm72:9000 as the fastcgi_pass. So you can use fpm53:9000/fpm56:9000/fpm72:9000 to create a php53/php56/php72 website if you want.

Here is a example for creating a php53 site:

Copy a conf file from site3.conf

If you want to create a php56/php72 site? Refer to site2.conf/site1.conf

$ cp ./conf/nginx/conf.d/site3.conf ./conf/nginx/conf.d/youDomainName.conf

Edit the field server_name(Your WebSite Domain) & root(Your WebSite Root Directory) in conf file:

Create the Site Web Root Directory

$ mkdir ./site/youDomainName Put the web files into the Directory Restart the docker

$ docker-compose restart

Acknowledgement

yeszao/dnmp micooz/docker-lnmp

版权声明:

1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。
2、网站不提供资料下载,如需下载请到原作者页面进行下载。
3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考学习用!
4、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。