-
Notifications
You must be signed in to change notification settings - Fork 34
Home
JaneEyer edited this page Oct 14, 2022
·
17 revisions
# 主流版本
## CentOS7 + Nginx + Node.js + MySQL + php-^7.4 + php5.6.40
docker pull 2233466866/lnmp
docker pull 2233466866/lnmp:1.13
# nosql版本
## CentOS7 + Nginx + Node.js + MySQL + php-^7.4 + php5.6.40 + Redis
docker pull 2233466866/lnmp:nosql
docker pull 2233466866/lnmp:1.13-nosql
# newest版本
## CentOS7 + Nginx + Node.js + MySQL + php-^8.1 + php-^7.4 + php5.6.40 + Redis
docker pull 2233466866/lnmp:newest
# mini版本
## CentOS7 + Nginx + php-^7.4
docker pull 2233466866/lnmp:mini
# 配置文件路径(Config file path)
# Nginx
/usr/local/nginx/conf/nginx.conf
# MySQL
/etc/my.cnf
# Redis
/usr/local/redis/redis.conf
# php-5
/usr/local/php5/lib/php.ini
/usr/local/php5/etc/php-fpm.conf
# php-7
/usr/local/php7/lib/php.ini
/usr/local/php7/etc/php-fpm.conf
/usr/local/php7/etc/php-fpm.d/www.conf
# php-8
/usr/local/php8/lib/php.ini
/usr/local/php8/etc/php-fpm.conf
/usr/local/php8/etc/php-fpm.d/www.conf
# 端口映射自行指定,容器名称自行指定为lnmp
docker run -dit --privileged=true --name=lnmp 2233466866/lnmp
# 高级用法(Advanced usage)
docker run -dit \
-p 80:80 \
-p 443:443 \
-v /宿主机自定义目录/www:/www \
-v /宿主机自定义目录/mysql:/data/mysql \
--name=lnmp \
2233466866/lnmp
# 如对配置文件比较熟悉,也可以通过宿主机挂载使用自定义的配置文件
# 容器名称与上一步保持一致
docker exec -it lnmp /bin/bash
ps aux|grep nginx
ps aux|grep mysql
ps aux|grep php5
ps aux|grep php7
ps aux|grep php8
ps aux|grep redis
# 或者(Or)
systemctl status nginx
systemctl status mysqld
systemctl status php5
systemctl status php7
systemctl status php8
systemctl status redis
# 切换PHP5
pvm 5
# 切换PHP7
pvm 7
# 切换PHP8
pvm 8
# PHP5
php5 [options] [-f] <file> [--] [args...]
# PHP7
php7 [options] [-f] <file> [--] [args...]
# PHP8
php8 [options] [-f] <file> [--] [args...]
cat /var/log/mysqld.log|grep 'A temporary password'
# 或
password=`cat /var/log/mysqld.log|grep 'A temporary password'`;password=${password:91};echo $password
# 请保持清醒头脑,明确自己是在容器内还是在服务器本身执行命令,以及-v挂载对文件的影响,以免造成不可挽回的损失
# 默认已安装部分扩展在目录:/usr/local/php7/lib/php/extensions/no-debug-non-zts-20170718/
# 如果要启用指定扩展,则需要修改php.ini,加上
extension=xxx.so
# xxx为PHP扩展的文件名,然后重启php
systemctl restart php7
# 各版本详细信息请参考
https://github.com/2233466866/lnmp/wiki
名称 | 官网 |
---|---|
Github | https://github.com/ |
阿里巴巴 | https://cr.console.aliyun.com/ |
Docker | https://hub.docker.com/ |
CentOS | https://www.centos.org/ |
Nginx | https://www.nginx.com/ |
MySQL | https://www.mysql.com/ |
PHP | https://www.php.net/ |
Redis | https://redis.io/ |
systemctl | gdraheim |