LNMP of Docker Version
- ubuntu:20.04
- mysql:latest
- account:root
- password:
- mongodb: 7.x
- nginx:latest
- redis:latest
- php
php phpunit 5.6 5 7.0 6 7.1 7 7.2 8 7.3 9 7.4 9 8.0 9 8.1 10 8.2 11 8.3 11 - ssh
-
clone project
git clone https://github.com/mika880911/dnmp.git
-
start container
# Windows .\start.bat # Mac、Linux ./start.sh
-
explain
config.jsonexample
{ // do not change or delete it, the system will maintain automatically "ip": "", // modify your value same as example, you need to check your config.json format is same as example while modifying this value "config_version": "1.7.0", // php cli version inside the container "php_cli_version": "8.2", // composer version inside the container "composer_version": "2", "folders": [ { // whether to use current folders mapping setting "enabled": true, // which local folder needs to be mapped to the container "local": "~/Desktop/projects", // where should the local folder be mapped to the container "container": "/var/www/projects" } ], "sites": [ { // whether to enable the current website setting "enabled": true, // site domain "domain": "laravel.test", // which folder of the container is the project entry point "entry_point": "/var/www/projects/demo1/public", // which configuration to use in datas/templates/nginx folder "nginx_template": "default.conf", // which PHP version should this site use "php_fpm_version": "8.2", // whether to add host mapping "auto_host": true, "cronjobs": [ { // whether to enable the current cronjob setting "enabled": true, // job setting "job": "* * * * * cd <entry_point>/../ && php<php_fpm_version> artisan schedule:run > /dev/null 2>&1" } ], "supervisors": [ { // whether to enable the current supervisor setting "enabled": true, // write key=value to supervisor setting "directory": "<entry_point>/../", "command": "php<php_fpm_version> artisan queue:work" } ] } ], "ports": [ { // whether to use current port mapping setting "enabled": true, // which port should be forwarded to the container "local": "80", // target of local port forwarding "container": "80" } ], "xdebug": { // whether to enable xdebug "enabled": true, // some ide need to use this value to listen xdebug, you can modify this value "idekey": "phpstorm", // which local port should receive xdebug data "port": 9003 } } -
exit container
exit
By default, the system will generate self-signed certificate automatically. If you want to use other certificate, you can put your ssl.crt and ssl.key into the datas/ssl/{domain} folder
Considering that the site settings required by each project are not necessarily the same, if ./datas/templates/nginx/default.conf does not meet your needs, you can create ./datas/templates/nginx/{name}.conf, and change the value of sites.*.template in ./config.json to {name}.conf
If you need to change php.ini setting you can change datas/templates/php/php-cli.ini and datas/template/php/php-fpm.ini
- vscode example (.vscode/launch.json)
{ "version": "0.2.0", "configurations": [ { "name": "Listen for Xdebug", "type": "php", "request": "launch", "port": 9003, "pathMappings": { "/var/www/projects/demo1": "${workspaceFolder}" } }, ] }
- You don't need to change any file inside src folder
- When you change anything, you need to restart the container to apply the settings
- If you loss your
config.jsonyou can copy fromsrc/templates/config/config.json