Symfony не загружает страницу - PullRequest
0 голосов
/ 30 августа 2018

Я только что настроил Symfony 3.4.15 в моем Ubuntu Server, и страница приветствия работает, но когда я хочу создать новую страницу, например / home, с контроллером, она не работает:

Не найдено

Запрошенный URL / 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 ]

0 голосов
/ 01 сентября 2018

Проблема была в том, что я забыл создать файл .htaccess внутри папки de / public.

0 голосов
/ 30 августа 2018

Мое лучшее предположение - у вас не включена перезапись URL.

Вы пытались использовать сервер разработки Symfony?

Убедитесь, что у вас есть что-то вроде hthis в вашем конфигурационном файле apache (обычно в /etc/apache2/apache2.conf):

<Directory /var/www/>
    Options -Indexes +FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
...