LAMP in 2 Minutes
Linux + Nginx + Mysql + PHP + phpMyAdmin in 2 minutes
Create a Linux server with Nginx web server, Mysql database and PHP in less than 2 minutes.
https://www.youtube.com/watch?v=V\_kj4zfSn4o Commands used> curl -fSSL https://get.docker.com/ | sh sudo systemctl enable docker.service Sudo Systemctl Start Docker curl -L “https://github.com/docker/compose/releases/download/1.9.0/docker-compose-$(uname -s) -$ (uname -m)” -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose mkdir LEMP CD LEMP mkdir logs Touch logs/nginx-access.log Touch logs/nginx-error.log mkdir to MySQL mkdir nginx mkdir html docker-compose up -d (learn what docker is and learn about docker commands here)docker-compose.yml file> nginx:
image: tutum/nginx
Ports:
- “80:80”
links:
- phpfpm
- MySQL
volumes:
-. /nginx/default:/etc/nginx/sites-available/default
-. /nginx/default:/etc/nginx/sites-enabled/default
- /Users/Uiraribeiro/Documents/LearnLinux/Public_HTML:/usr/share/nginx/html
phpfpm:
image: php:fpm
Ports:
- “9001:9000”
volumes:
- /Users/Uiraribeiro/Documents/LearnLinux/Public_HTML:/usr/share/nginx/html
links:
- MySQL
MySQL:
image: mariadb
Environment:
MYSQL_ROOT_PASSWORD: admin
volumes:
-. /mysql:/var/lib/mysql
phpmyadmin:
image: phpmyadmin/phpmyadmin
restart: always
links:
- MySQL
Ports:
- 8181:80
Environment:
MYSQL_USERNAME: admin
MYSQL_ROOT_PASSWORD: admin
PMA_ARBITRARY: 1
nginx/default file> server {
listen 80;
root /usr/share/nginx/html;
index index.php index.html index.html;
server_name 127.0.0.1; # CHANGE YOUR IP HERE
location/{
try_files $uri $uri/ /index.php $is_args$args;
}
location ~ .php$ {
fastcgi_split_path_info ^ (.+ .php) (/.+) $;
fastcgi_pass phpfpm:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
includes fastcgi_params;
}
}
Learn and develop your skills with the full Docker for DevOps course from the Linux Certification. You can enroll here with a free 7-day trial. If you already have an account, you can log in here.## Did you like it? Share :-)