Symfony部署,一些路由不起作用(Apache2)

时间:2018-01-31 18:33:57

标签: symfony doctrine apache2

我正在尝试让我的应用程序在生产服务器上运行。服务器在共享托管vps上运行Red Hat和Apache。大多数页面都显示静态信息,但在访问进行数据库调用的页面时,我直接得到500响应。

以及在登录页面上发布时。 这是日志是我能找到的日志:

[2018-01-31 13:25:16] request.INFO: Matched route "login_page". {"route":"login_page","route_parameters":{"_controller":"App\\Controller\\DefaultController::loginAction","_route":"login_page"},"request_uri":"http://97024092.hetictlyceum.nl/index.php/login","method":"POST"} []
[2018-01-31 13:25:16] php.WARNING: Warning: require(/home/u970240/public_html/dedissel/var/cache/prod/doctrine/orm/Proxies/__CG__AppEntityKlantgegeven.php): failed to open stream: No such file or directory {"exception":"[object] (ErrorException(code: 0): Warning: require(/home/u970240/public_html/dedissel/var/cache/prod/doctrine/orm/Proxies/__CG__AppEntityKlantgegeven.php): failed to open stream: No such file or directory at /home/u970240/public_html/dedissel/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php:223)"} []
[2018-01-31 13:25:16] php.CRITICAL: Fatal Compile Error: require(): Failed opening required '/home/u970240/public_html/dedissel/var/cache/prod/doctrine/orm/Proxies/__CG__AppEntityKlantgegeven.php' (include_path='.:/opt/alt/php71/usr/share/pear') {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 0): Compile Error: require(): Failed opening required '/home/u970240/public_html/dedissel/var/cache/prod/doctrine/orm/Proxies/__CG__AppEntityKlantgegeven.php' (include_path='.:/opt/alt/php71/usr/share/pear') at /home/u970240/public_html/dedissel/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php:223)"} []
[2018-01-31 13:25:16] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalErrorException: "Compile Error: require(): Failed opening required '/home/u970240/public_html/dedissel/var/cache/prod/doctrine/orm/Proxies/__CG__AppEntityKlantgegeven.php' (include_path='.:/opt/alt/php71/usr/share/pear')" at /home/u970240/public_html/dedissel/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php line 223 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 0): Compile Error: require(): Failed opening required '/home/u970240/public_html/dedissel/var/cache/prod/doctrine/orm/Proxies/__CG__AppEntityKlantgegeven.php' (include_path='.:/opt/alt/php71/usr/share/pear') at /home/u970240/public_html/dedissel/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php:223)"} []

我正在使用的htaccess:

<VirtualHost *:80>
    ServerName 97024092.hetictlyceum.nl
    ServerAlias www.97024092.hetictlyceum.nl
    DocumentRoot /home/u970240/public_html/dedissel/public

    <Directory /home/u970240/public_htmk/dedissel/public>
        AllowOverride All
        Require all granted
        Allow from All

        <IfModule mod_negotiation.c>
            Options -MultiViews
        </IfModule>
        <IfModule mod_rewrite.c>
            RewriteEngine On
            RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
            RewriteRule ^(.*) - [E=BASE:%1]
            RewriteCond %{HTTP:Authorization} .
            RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
            RewriteCond %{ENV:REDIRECT_STATUS} ^$
            RewriteRule ^app\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
            RewriteRule permanent ^ %{ENV:BASE}/index.php [L]
        </IfModule>

        <IfModule !mod_rewrite.c>
            <IfModule mod_alias.c>
                RedirectMatch 302 ^/$ /index.php/
            </IfModule>
        </IfModule>
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/${APP_NAME}-error.log
    CustomLog ${APACHE_LOG_DIR}/${APP_NAME}-access.log combined
</VirtualHost>

我尝试了另一个htaccess:

<VirtualHost *:80>
    ServerName 97024092.hetictlyceum.nl
    ServerAlias www.97024092.hetictlyceum.nl
    DocumentRoot /home/u970240/public_html/dedissel/public

    <Directory /home/u970240/public_htmk/dedissel/public>
        AllowOverride All
        Require all granted
        Allow from All

        <IfModule mod_rewrite.c>
            DirectoryIndex index.php
            Options -MultiViews
            RewriteEngine On
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*)$ index.php [QSA,L]
        </IfModule>
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/${APP_NAME}-error.log
    CustomLog ${APACHE_LOG_DIR}/${APP_NAME}-access.log combined
</VirtualHost>

此错误是否与任何权限类型的错误有关?任何建议都有帮助

提前致谢!

1 个答案:

答案 0 :(得分:0)

为什么你认为这是apache / modrewrite的事情?

根据您首先提供的日志尝试

rm -rf var/cache/*
chmod 777 var/cache