1,安装mariadb创建网路
docker network create --subnet=172.18.0.0/16 mynetwork
docker run -d -p 3306:3306 -e MysqL_ROOT_PASSWORD=root --net mynetwork --ip 172.18.0.2 --name mariadb mariadb:latest
docker run -d -p 6379:6379 --net mynetwork --ip 172.18.0.3 --name redis redis查看
MysqL -h127.0.0.1 -uroot -proot2,安装Nginx-PHP7.4安装centos
docker run -itd --privileged --net mynetwork --ip 172.18.0.3 -v /Users/vckin/Desktop/vckin/app/code:/var/www -v /Users/vckin/Desktop/vckin/Nginx:/etc/Nginx/conf.d -p 80:80 -p 443:443 --name Nginx-PHP73 centos:latest /usr/sbin/init进入docker 里面安装PHP7.4
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm yum -y install yum-utils yum-config-manager --enable remi-PHP74 yum update yum install PHP PHP-cli yum install PHP-fpm PHP-cli PHP-bcmath PHP-gd PHP-Json PHP-mbstring PHP-mcrypt PHP-MysqLnd PHP-opcache PHP-pdo PHP-pecl-crypto PHP-pecl-mcrypt PHP-pecl-geoip PHP-recode PHP-snmp PHP-soap PHP-xmll PHP-PHP-dom PHP-zip PHP-process PHP-redis systemctl start PHP-fpm安装composer
PHP -r "copy('https://install.PHPcomposer.com/installer', 'composer-setup.PHP');" PHP composer-setup.PHP PHP -r "unlink('composer-setup.PHP');" mv composer.phar /usr/local/bin/composer安装Nginx
yum install Nginx -y systemctl start Nginx测试Nginx 创建/Users/vckin/Desktop/vckin/Nginx/test.conf
server { #侦听80端口 Listen 80; index index.PHP index.HTML index.htm; #设定本虚拟主机的访问日志 server_name localhost; root /var/www/public; #rewrite_log on; #access_log logs/hc-admin.access.log main; #error_log logs/hc-admin.access.log main; location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|Js|CSS|ttf|woff|woff2)$ { root /var/www/public; } location / { index index.htm index.HTML index.PHP; if (!-e $request_filename) { rewrite ^/(.*)$ /index.PHP/ last; break; } } location ~ \.PHP/?.*$ { root /var/www/public; #此处为docker Gateway ip fastcgi_pass 127.0.0.1:9000; fastcgi_index index.PHP; #加载Nginx默认"服务器环境变量"配置 #include fastcgi.conf; include fastcgi_params; set $fastcgi_script_name2 $fastcgi_script_name; if ($fastcgi_script_name ~ "^(.+\.PHP)(/.+)$") { set $fastcgi_script_name2 ; set $path_info ; } fastcgi_param PATH_INFO $path_info; fastcgi_param SCRIPT_filename $document_root$fastcgi_script_name2; fastcgi_param SCRIPT_name $fastcgi_script_name2; } }4,测试创建 index.PHP
PHPinfo();
相关推荐:最新的五个Laravel视频教程总结
以上是内存溢出为你收集整理的详解docker安装Laravel环境【nginx mariadb PHP7.4】全部内容,希望文章能够帮你解决详解docker安装Laravel环境【nginx mariadb PHP7.4】所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)