Envoyer.io、Laravel - 正在尝试访问 /public 下目录的内容

Envoyer.io, Laravel - Attempting to access contents of directory under /public

更新

似乎 /storage/app/thirdpartydirectory 下的所有 PHP 文件都没有被执行,而是抛出了 Laravel NotFoundHttpException。可以通过 http://example.com/thirdpartydirectory.

访问简单的文本文件、图像等

原题

我正在构建一个 Laravel 5 站点,使用 Envoyer.io 进行代码部署。 Envoyer 的工作方式,新代码被推送到站点并放置在 /releases 目录下,然后从顶层符号链接到 /current(所以 /current 总是指向最新的 /releases 子目录).

问题是我放在站点 /public 目录中的任何内容都包含在 Envoyer 部署中,因此每次我推送新代码时都会复制。我正在尝试使用必须将其 index.php 和其他 files/directories 直接暴露给外界的第三方应用程序。首次加载应用程序时,安装过程开始,并将其他配置文件安装到其各个文件夹中。当我部署我的下一批代码时,/public 在没有第三方应用程序生成的安装和缓存文件的情况下再次被推送 - 从而导致不得不 运行 一遍又一遍地安装过程的循环。

我就此联系了 Taylor Otwell,他的建议是将应用程序放在 /storage/app/thirdpartyapp 中,然后在激活每个新部署之前从每个版本的 public 目录创建一个符号链接 -

cd {{release}}
ln -s /home/eyf/storage/app/thirdpartyapp public/thirdpartyapp

这创建了一个没有任何问题的符号链接,但是当我尝试访问该应用程序时(http://example.com/thirdpartyapp), I get stuck on the Laravel NotFoundHttpException page. The app has an index.php, if I go to http://example.com/thirdpartyapp/index.php,反而加载了 Laravel 站点的索引页面 - 几乎就像它完全忽略了符号链接和 /thirdpartyapp 在 URL.

该应用确实附带了以下 .htaccess,不确定它是否对所有这些有任何影响:

<IfModule mod_alias.c>
    # by default disallow access to the base git folder
    RedirectMatch /\.git(/|$) /404
</IfModule>

# cache images for a while
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType text/javascript "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/jpg "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
</IfModule>

# compress output if we can
<IfModule mod_deflate.c>
    # Set output filter for zipping content
    SetOutputFilter DEFLATE
    # Netscape 4.x and 4.06-4.08 have issues
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    # MSIE can be an issue, for now catch all MSIE
    BrowserMatch \bMSIE[56] !no-gzip !gzip-only-text/html
    # Exclude file types from compression
    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|pdf|zip|tar|rar|gz|dmg|mp3|mp4|m4a|m4p|mov|mpe?g|qt|swf)$ no-gzip dont-vary
    # Make sure proxy servers deliver what they're given
    <IfModule mod_headers.c>
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
</IfModule>

<IfModule mod_rewrite.c>
    RewriteEngine ON

    # Set this if you have your installation in a subdirectory
    # RewriteBase /openvbx

    # By default always use SSL
    #RewriteCond %{HTTPS} !=on
    #RewriteRule ^(.*) https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*) index.php?vbxsite= [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L,QSA]
    #RewriteRule ^(.*) index.php/ [L,QSA]

    ErrorDocument 404 /fallback/rewrite.php
</IfModule>

显然 PHP 放置在 Laravel 应用中 /storage 下的代码未执行。我将第三方应用程序的目录移动到父文件夹并链接到它,现在一切正常。