1. 修改虚拟站点配置:
server { listen 80; server_name pintuu.ddd; root /www/web/pintuu/web; index index.php index.html index.htm; location / { # 将所有不是真实文件的路由重定向到 index.php try_files $uri $uri/ /index.php$is_args$args; } location /backend { # 将所有不是真实文件的路由重定向到 index.php try_files $uri $uri/ /backend/index.php$is_args$args; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /www/web/pintuu/web; } location ~ \.php$ { fastcgi_pass php72:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht { deny all; } }
2. 修改数据库配置:
# host 要写 mysql 容器的名字 return [ 'components' => [ 'db' => [ 'class' => 'yii\db\Connection', 'dsn' => 'mysql:host=mysql;dbname=pintuu', 'username' => 'root', 'password' => '123456', 'charset' => 'utf8', //'tablePrefix' => '', ], ], ];
3. 设置runtime、assets、uploads等目录可写;
4. 重置nginx:
docker restart nginx