mirror of
https://github.com/v2board/v2board.git
synced 2025-01-31 02:29:14 +08:00
done
This commit is contained in:
parent
710f454122
commit
794538d7f4
4
.gitignore
vendored
4
.gitignore
vendored
@ -7,7 +7,11 @@
|
|||||||
.env
|
.env
|
||||||
.env.backup
|
.env.backup
|
||||||
.phpunit.result.cache
|
.phpunit.result.cache
|
||||||
|
.idea
|
||||||
Homestead.json
|
Homestead.json
|
||||||
Homestead.yaml
|
Homestead.yaml
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
yarn-error.log
|
yarn-error.log
|
||||||
|
composer.phar
|
||||||
|
yarn.lock
|
||||||
|
dbdata
|
||||||
|
25
docker-compose.yml
Normal file
25
docker-compose.yml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
container_name: v2board-db
|
||||||
|
image: mysql
|
||||||
|
environment:
|
||||||
|
- MYSQL_ALLOW_EMPTY_PASSWORD=true
|
||||||
|
volumes:
|
||||||
|
- ./dbdata:/var/lib/mysql
|
||||||
|
- ./install.sql:/install.sql
|
||||||
|
phpfpm:
|
||||||
|
image: bitnami/php-fpm
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
nginx:
|
||||||
|
image: nginx
|
||||||
|
depends_on:
|
||||||
|
- phpfpm
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
- ./nginx:/etc/nginx/conf.d
|
||||||
|
ports:
|
||||||
|
- 8964:80
|
||||||
|
|
2
init.sh
2
init.sh
@ -1,4 +1,2 @@
|
|||||||
wget https://getcomposer.org/download/1.9.0/composer.phar
|
|
||||||
php composer install
|
|
||||||
php artisan key:generate
|
php artisan key:generate
|
||||||
php artisan config:cache
|
php artisan config:cache
|
52
nginx/backend.conf
Normal file
52
nginx/backend.conf
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
server {
|
||||||
|
# 监听 HTTP 协议默认的 [80] 端口。
|
||||||
|
listen 80;
|
||||||
|
# 绑定主机名 [example.com]。
|
||||||
|
server_name localhost;
|
||||||
|
# 服务器站点根目录 [/example.com/public]。
|
||||||
|
root /app/public;
|
||||||
|
|
||||||
|
# 添加几条有关安全的响应头;与 Google+ 的配置类似,详情参见文末。
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN";
|
||||||
|
add_header X-XSS-Protection "1; mode=block";
|
||||||
|
add_header X-Content-Type-Options "nosniff";
|
||||||
|
|
||||||
|
# 站点默认页面;可指定多个,将顺序查找。
|
||||||
|
# 例如,访问 http://example.com/ Nginx 将首先尝试「站点根目录/index.html」是否存在,不存在则继续尝试「站点根目录/index.htm」,以此类推...
|
||||||
|
index index.html index.htm index.php;
|
||||||
|
|
||||||
|
# 指定字符集为 UTF-8
|
||||||
|
charset utf-8;
|
||||||
|
|
||||||
|
# Laravel 默认重写规则;删除将导致 Laravel 路由失效且 Nginx 响应 404。
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php?$query_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
# 关闭 [/favicon.ico] 和 [/robots.txt] 的访问日志。
|
||||||
|
# 并且即使它们不存在,也不写入错误日志。
|
||||||
|
location = /favicon.ico { access_log off; log_not_found off; }
|
||||||
|
location = /robots.txt { access_log off; log_not_found off; }
|
||||||
|
|
||||||
|
# 将 [404] 错误交给 [/index.php] 处理,表示由 Laravel 渲染美观的错误页面。
|
||||||
|
error_page 404 /index.php;
|
||||||
|
|
||||||
|
# URI 符合正则表达式 [\.php$] 的请求将进入此段配置
|
||||||
|
location ~ \.php$ {
|
||||||
|
# 配置 FastCGI 服务地址,可以为 IP:端口,也可以为 Unix socket。
|
||||||
|
fastcgi_pass phpfpm:9000;
|
||||||
|
# 配置 FastCGI 的主页为 index.php。
|
||||||
|
fastcgi_index index.php;
|
||||||
|
# 配置 FastCGI 参数 SCRIPT_FILENAME 为 $realpath_root$fastcgi_script_name。
|
||||||
|
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||||
|
# 引用更多默认的 FastCGI 参数。
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
# 通俗地说,以上配置将所有 URI 以 .php 结尾的请求,全部交给 PHP-FPM 处理。
|
||||||
|
|
||||||
|
# 除符合正则表达式 [/\.(?!well-known).*] 之外的 URI,全部拒绝访问
|
||||||
|
# 也就是说,拒绝公开以 [.] 开头的目录,[.well-known] 除外
|
||||||
|
location ~ /\.(?!well-known).* {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
}
|
37
readme.md
37
readme.md
@ -1 +1,36 @@
|
|||||||
sh init.sh
|
|
||||||
|
## Environment:
|
||||||
|
|
||||||
|
- PHP7.3+
|
||||||
|
- composer
|
||||||
|
- MySQL5.5+
|
||||||
|
|
||||||
|
## Steps
|
||||||
|
|
||||||
|
### Before
|
||||||
|
|
||||||
|
执行 `cp .env.example .env` 然后配置它;
|
||||||
|
|
||||||
|
### 本地环境部署
|
||||||
|
|
||||||
|
1. 下载 composer
|
||||||
|
> ```shell script
|
||||||
|
> wget https://getcomposer.org/download/1.9.0/composer.phar
|
||||||
|
> php composer.phar install
|
||||||
|
> ```
|
||||||
|
2. 初始化项目
|
||||||
|
> ```shell script
|
||||||
|
> sh init.sh
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
3. 从 `install.sql` 文件中恢复表
|
||||||
|
|
||||||
|
|
||||||
|
### Docker 环境部署
|
||||||
|
1. 初始化项目
|
||||||
|
> ```shell script
|
||||||
|
> docker run --rm -v $(pwd):/app composer install
|
||||||
|
> docker run --rm -v $(pwd):/app composer sh init.sh
|
||||||
|
> ```
|
||||||
|
2. 进入 docker 容器从 `install.sql` 文件中恢复表
|
||||||
|
3. 执行 `docker-compose up -d` 启动服务
|
||||||
|
Loading…
Reference in New Issue
Block a user