Symfony2 AngularJS无法删除web / app_dev.php

时间:2016-02-11 22:33:00

标签: php angularjs apache .htaccess symfony

我有一个Symfony AngularJS应用程序,我已经在VPS上托管了它。我使用softalicious安装了Symfony,它很好地使它快速运行。

我现在在哪里

http://website.com/web/app.php显示:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@website.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

http://website.com/web/app_dev.php有效

每当我尝试删除web / app_dev.php时,我都会收到上述错误。

我尝试了以下

  • 将DocumentRoot更改为web /
  • 将RewriteBase /添加到项目根目录.htaccess
  • 将RewriteBase / web /添加到网络文件夹.htaccess
  • 将RewriteBase /添加到项目根目录.htaccess
  • 将RewriteBase / web /添加到网络文件夹.htaccess

早些时候http://website.com/web/app.php也有效,但上面的一个或者别的东西让它开始抛出500内部服务器错误。

我在项目根目录和web文件夹中有一个默认的.htaccess我将它附加如下以供参考(它不是太大,大部分都是注释):

# Use the front controller as index file. It serves as a fallback solution when
# every other rewrite/redirect fails (e.g. in an aliased environment without
# mod_rewrite). Additionally, this reduces the matching process for the
# start page (path "/") because otherwise Apache will apply the rewriting rules
# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
DirectoryIndex app.php

# By default, Apache does not evaluate symbolic links if you did not enable this
# feature in your server configuration. Uncomment the following line if you
# install assets as symlinks or if you experience problems related to symlinks
# when compiling LESS/Sass/CoffeScript assets.
# Options FollowSymlinks

# Disabling MultiViews prevents unwanted negotiation, e.g. "/app" should not resolve
# to the front controller "/app.php" but be rewritten to "/app.php/app".
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # Determine the RewriteBase automatically and set it as environment variable.
    # If you are using Apache aliases to do mass virtual hosting or installed the
    # project in a subdirectory, the base path will be prepended to allow proper
    # resolution of the app.php file and to redirect to the correct URI. It will
    # work in environments without path prefix as well, providing a safe, one-size
    # fits all solution. But as you do not need it in this case, you can comment
    # the following 2 lines to eliminate the overhead.
    RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
    RewriteRule ^(.*) - [E=BASE:%1]

    # Sets the HTTP_AUTHORIZATION header removed by apache
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect to URI without front controller to prevent duplicate content
    # (with and without `/app.php`). Only do this redirect on the initial
    # rewrite by Apache and not on subsequent cycles. Otherwise we would get an
    # endless redirect loop (request -> rewrite to front controller ->
    # redirect -> request -> ...).
    # So in case you get a "too many redirects" error or you always get redirected
    # to the start page because your Apache does not expose the REDIRECT_STATUS
    # environment variable, you have 2 choices:
    # - disable this feature by commenting the following 2 lines or
    # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
    #   following RewriteCond (best solution)
    RewriteCond %{ENV:REDIRECT_STATUS} ^$
    RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]

    # If the requested filename exists, simply serve it.
    # We only want to let Apache serve files and not directories.
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule .? - [L]

    # Rewrite all other queries to the front controller.
    RewriteRule .? %{ENV:BASE}/app.php [L]
</IfModule>

<IfModule !mod_rewrite.c>
    <IfModule mod_alias.c>
        # When mod_rewrite is not available, we instruct a temporary redirect of
        # the start page to the front controller explicitly so that the website
        # and the generated links can still be used.
        RedirectMatch 302 ^/$ /app.php/
        # RedirectTemp cannot be used instead
    </IfModule>
</IfModule>

更新

今天

error_log文件显示:

[Sat Feb 13 05:47:28 2016] [error] [client 27.251.209.122] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Sat Feb 13 05:47:29 2016] [error] [client 27.251.209.122] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://website.com/
[Sat Feb 13 05:47:29 2016] [error] [client 27.251.209.122] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://website.com/ the limit if necessary.
[Sat Feb 13 05:53:06 2016] [error] [client 27.251.209.122] SoftException in Application.cpp:355: UID of script "/home/website/public_html/web/app.php" is smaller than min_uid
[Sat Feb 13 05:53:06 2016] [error] [client 27.251.209.122] Premature end of script headers: app.php

希望这有助于调试问题。

更新

我尝试从项目根目录中删除.htaccess文件,我得到以下内容:

.git/
.gitignore
LICENSE
README.md
UPGRADE-2.2.md
UPGRADE-2.3.md
UPGRADE-2.4.md
UPGRADE-2.8.md
UPGRADE.md
bin/
cgi-bin/
components/
composer.json
composer.lock
composer.lock.orig
composer.lock.rej
composer.phar
notindex.php
source/
vendor/
web/

所以我的.htaccess是导致问题的原因。不是吗?

感谢任何帮助。

谢谢!

0 个答案:

没有答案