更新
似乎没有执行放置在/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目录中创建一个符号链接-
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,不确定它在所有这些方面是否有任何不同:
<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>发布于 2015-04-27 23:26:56
显然,在Laravel应用程序中放置在/storage下的PHP代码不会被执行。我将第三方应用程序的目录移到了父文件夹,并与其进行了符号链接,现在一切都正常了。
https://stackoverflow.com/questions/29907111
复制相似问题