aldearco / arco
Arco 框架项目
v0.2.0
2023-02-08 19:43 UTC
Requires
- aldearco/arco-framework: ^0.2.0
README
Arco 框架
本框架受 Laravel 启发,绝无与 Laravel 竞争之意。
Arco 框架是在以下 Mastermind 课程的教育目的下创建的
用 PHP 创建自己的 Web 框架
警告
此框架不适用于生产环境,可能存在多个错误。目前,其开发仅用于教育目的。
创建项目
Composer
composer create-project aldearco/arco
下载源代码
最新版本
解压并运行 composer install
。
部署
根目录
如果在根目录中进行部署,则不需要向项目中添加任何其他文件,但需要在该文件中指定服务器默认的公开文件夹名称。默认情况下,公开文件夹为 /public,但如需将其更改为 /public_html,可以在 ./config/app.php 文件中的 "public" 键中进行更改。
共享托管
如果将项目部署在公共或 public_html 文件夹内的共享托管中,根据您的服务器系统,可能需要创建某些文件。您可能需要修改或添加一些建议的代码行。
Apache
.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
# Serve existing files in the /public folder as if they were in the root of the site.
RewriteCond %{DOCUMENT_ROOT}public%{REQUEST_URI} -f
RewriteRule (.+) /public/$1 [L]
# Route requests for /storage/ to the /storage/ directory using the P(passthrough) flag.
RewriteRule ^storage/(.+) /storage/$1 [PT]
# Route everything else to /public/index.php
RewriteRule ^ /public/index.php [L]
</IfModule>
#Disable index view
options -Indexes
<Files .env>
order allow,deny
Deny from all
</Files>
Nginx
mysite.conf
server {
listen 80;
server_name example.com;
root /var/www/example.com;
location / {
try_files $uri $uri/ /public/index.php;
}
location /public {
try_files $uri $uri/ /public/index.php;
}
location /storage {
internal;
}
location ~ \.env$ {
deny all;
}
location ~ ^/storage/ {
internal;
}