Symfony 不加载页面

标签 symfony ubuntu server apache2 lamp

我刚刚在我的 Ubuntu 服务器 中配置了 Symfony 3.4.15 并且欢迎页面可以正常工作,但是当我想创建一个新页面时,例如/home, Controller 不起作用:

Not Found

The requested URL /home was not found on this server. Apache/2.4.18 (Ubuntu) Server at 167.99.90.60 Port 80

我遵循了 Symfony 文档中的所有步骤,但它不起作用...

我读到问题是由我的 Apache2 配置引起的,但我不知道如何解决。

我在我的 Ubuntu 服务器上安装了 LAMP。

apache2 配置是这样的:

<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

<Directory /var/www/my-project/public>
        Options FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

#<Directory /srv/>
#       Options Indexes FollowSymLinks
#       AllowOverride None
#       Require all granted
#</Directory>

这是我的虚拟主机文件配置:

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname $
        # the server uses to identify itself. This is used when creat$
        # redirection URLs. In the context of virtual hosts, the Serv$
        # specifies what hostname must appear in the request's Host: $
        # match this virtual host. For the default virtual host (this$
        # value is not decisive as it is used as a last resort host r$
        # However, you must set it for any further virtual host expli$
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/my-project/public

        # Available loglevels: trace8, ..., trace1, debug, info, noti$
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For ex$
        # following line enables the CGI configuration for this host $
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

有什么想法吗?

最佳答案

问题是我忘记在 de/public 文件夹中创建我的 .htaccess 文件。

关于Symfony 不加载页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52098900/

相关文章:

symfony - 如何在 Symfony2 中使用类范围的 ace?

ruby-on-rails - Rails 服务器问题

ubuntu - SCP不问 "Continue or not"

c# - 如何在单声道开发中添加自定义配置?

PHP - setlocale(LC_MONETARY, 'en_IN' );不工作

django - 关于 wsgi.py 中 wsgi 模块的 Ubuntu 16.04 服务器错误

添加: The Doctrine type of the . ...时出现Symfony EasyAdmin 3.x ManyToMany错误...字段为 "4",EasyAdmin尚不支持

php - Doctrine 不会在 Mysql 中保留具有 bool 值和 PDO::ATTR_EMULATE_PREPARES = false 的实体

twig 文件中的 css 和 scss

PHP:在 Ubuntu 12.04 上从不可用的存储库中干净地升级/替换 PHP