Browse Source

:memo: add laravel@container setup steps

Jeremy Zheng 3 years ago
parent
commit
80ae379dad

+ 4 - 3
documents/deployment/README.md

@@ -37,11 +37,12 @@ sudo apt install -y bzip2
 tar xf palm-alpine.tar.xz
 # 导入镜像
 podman load -i palm-alpine-TIMESTAMP.tar
-# clone 代码
-git clone -b agile https://github.com/iapt-platform/mint.git ~/workspace/YOUR_PROJECT
+# clone 代码 PLEASE CHANGE IT TO YOUR REPO
+git clone -b agile https://github.com/iapt-platform/mint.git ~/workspace/iapt-platform/mint
+git clone -b laravel https://github.com/iapt-platform/mint.git ~/workspace/iapt-platform/mint-laravel
 # 启动镜像
 cd ~/workspace
-./YOUR_PROJECT/docker/alpine/start.sh
+./iapt-platform/mint/docker/alpine/start.sh
 ```
 
 ## 部署

+ 22 - 0
documents/development/php/README.md

@@ -14,3 +14,25 @@ chmod 777 FOLDER_NAME
 # for file
 chmod 666 FILE_NAME
 ```
+
+## Php-Nginx for local container
+
+- 打补丁 `palm-jammy-20220929140150`
+
+  ```bash
+  apt install php-sqlite3
+  ```
+
+- 权限设置
+
+  ```bash
+  # 设置日志目录
+  cd /workspace/iapt-platform
+  mkdir tmp
+  chmod 777 tmp
+  cd /workspace/iapt-platform/mint-laravel
+  # 修复文件权限
+  ../mint/scripts/spring/laravel.sh
+  ```
+
+- 用 [laravel.conf](laravel.conf) 替换 `/etc/nginx/sites-enabled/default`

+ 34 - 0
documents/development/php/laravel.conf

@@ -0,0 +1,34 @@
+server {
+  listen 8080;
+  server_name _;
+
+  access_log /workspace/iapt-platform/tmp/nginx-access.org;
+  error_log /workspace/iapt-platform/tmp/nginx-error.log;
+
+  add_header X-Frame-Options "SAMEORIGIN";
+  add_header X-Content-Type-Options "nosniff";
+
+  root /workspace/iapt-platform/mint-laravel/public;
+  index index.html index.php;
+
+  charset utf-8;
+  gzip on;
+  client_max_body_size 16M;
+
+  location / {
+    try_files $uri $uri/ /index.php?$query_string;
+  }
+
+  location = /favicon.ico { access_log off; log_not_found off; }
+  location = /robots.txt  { access_log off; log_not_found off; }
+  error_page 404 /index.php;
+  
+  location ~ \.php$ {
+    fastcgi_pass unix:/run/php/php-fpm.sock;
+    fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
+    include fastcgi_params;
+  }
+  location ~ /\.(?!well-known).* {
+    deny all;
+  }
+}

+ 0 - 0
scripts/spring/laraven.sh → scripts/spring/laravel.sh


+ 1 - 1
scripts/spring/user.sh

@@ -67,7 +67,7 @@ server {
   location = /robots.txt  { access_log off; log_not_found off; }
   error_page 404 /index.php;
   
-  location ~ \.php$ {
+  location ~ \.php\$ {
     fastcgi_pass unix:/run/php/php-fpm.sock;
     fastcgi_param SCRIPT_FILENAME \$realpath_root\$fastcgi_script_name;
     include fastcgi_params;