2021-06-03

@[TOC]Laradock 配置生产环境

Laradock 配置生产环境

  1. git clone https://github.com/laradock/laradock.git

  2. 进入laradock文件夹并复制env-example to .env 并配置mysql和php版本

MYSQL_VERSION=5.7
MYSQL_DATABASE=default
MYSQL_USER=default
MYSQL_PASSWORD=secret
MYSQL_PORT=3306
MYSQL_ROOT_PASSWORD=root
  1. 进入nginx/sites为访问的不同的域名创建配置文件去指向不同的项目目录
server {

    listen 80;

    # For https
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server ipv6only=on;
    # ssl_certificate /etc/nginx/ssl/default.crt;
    # ssl_certificate_key /etc/nginx/ssl/default.key;

    server_name www.XXX.com;
    root /var/www/XXX/public;
    index index.php index.html index.htm;

    location / {
         try_files $uri $uri/ /index.php$is_args$args;
    }

    location ~ \.php$ {
        try_files $uri /index.php =404;
        fastcgi_pass php-upstream;
        fastcgi_index index.php;
        fastcgi_buffers 16 16k;
        fastcgi_buffer_size 32k;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        #fixes timeouts
        fastcgi_read_timeout 600;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }

    location /.well-known/acme-challenge/ {
        root /var/www/nxhospital/letsencrypt/;
        log_not_found off;
    }
}

  1. 配置运行项目.env文件

  2. docker-compose up -d nginx mysql redis

  3. docker-compose exec workspace bash

可能会用到的命令

docker-compose build --no-cache mysql

上一篇:WebRTC 入门到放弃(一)WebRTC


下一篇:在CentOS7已有nginx下安装Discuz