首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Envoyer.io,Laravel -试图访问/public下的目录内容

Envoyer.io,Laravel -试图访问/public下的目录内容
EN

Stack Overflow用户
提问于 2015-04-27 22:30:49
回答 1查看 665关注 0票数 0

更新

似乎没有执行放置在/storage/app/thirdpartydirectory下的任何PHP文件,而是抛出了Laravel NotFoundHttpException。简单的文本文件、图像等可以通过http://example.com/thirdpartydirectory访问。

原始问题

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

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

我联系了泰勒奥特威尔,他的建议是将应用程序放在/storage/app/thirdpartyapp中,然后在激活每个新部署之前,从每个发行版的public目录中创建一个符号链接-

代码语言:javascript
复制
cd {{release}}
ln -s /home/eyf/storage/app/thirdpartyapp public/thirdpartyapp

这创建了一个没有任何问题的符号链接,但是当我尝试访问应用程序(http://example.com/thirdpartyapp)时,我被困在了Laravel NotFoundHttpException页面上。这个应用程序有一个index.php,如果我转到http://example.com/thirdpartyapp/index.php,就会加载Laravel的索引页面--就好像它完全忽略了URL中的符号链接和/thirdpartyapp

该应用程序附带了以下.htaccess,不确定它在所有这些方面是否有任何不同:

代码语言:javascript
复制
<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=$1 [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L,QSA]
    #RewriteRule ^(.*) index.php/$1 [L,QSA]

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

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-04-27 23:26:56

显然,在Laravel应用程序中放置在/storage下的PHP代码不会被执行。我将第三方应用程序的目录移到了父文件夹,并与其进行了符号链接,现在一切都正常了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29907111

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档