代码之家  ›  专栏  ›  技术社区  ›  HessianMad

Symfony不加载页面

  •  0
  • HessianMad  · 技术社区  · 7 年前

    我刚配置好 Symfony 3.4.15在我的 Ubuntu Server Welcome页可以工作,但是当我想用控制器创建一个新页时,例如/home,它不工作:

    找不到

    Apache/2.4.18(Ubuntu)服务器167.99.90.60端口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
    

    2 回复  |  直到 7 年前
        1
  •  0
  •   Magnesium    7 年前

    我猜你没有启用url覆盖。

    你试过使用Symfony开发服务器吗?

    确保在apache配置文件(通常在/etc/apache2/apache2.conf中)中有类似hthis的内容:

    <Directory /var/www/>
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    
        2
  •  0
  •   HessianMad    7 年前

    问题是我忘了创建 .htaccess

    推荐文章