我正在尝试部署我的symfony 4应用程序。我从目录启动了symfony服务器,它正在监听
127:0.0.1:888
my/etc/apache2/sites enabled/nameofdomain.conf是:

Listen 888
<VirtualHost *:888>
   ServerName domain.com
   ServerAlias domain.com

   DocumentRoot /var/www/html/Project/public
    <Directory /var/www/html/Project/public>
        AllowOverride All
        Require all granted
        Allow from All

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

    <Directory /var/www/html/Project/public/bundles>
        <IfModule mod_rewrite.c>
            RewriteEngine Off
        </IfModule>
    </Directory>
    ErrorLog /var/log/apache2/domain.com_error.log
    CustomLog /var/log/apache2/domain.com_access.log combined
</VirtualHost>

当我进入domain:888时,总是被重定向到domain:888/index.php/并出现错误
找不到“get/”的路由
当我进入domain:888/correctpath时,出现apache错误“not found”。
我有apache 2.4.18和ubuntu 16.04。
你能帮我怎么提供应用程序吗?

最佳答案

弗斯特

composer require symfony/apache-pack

那么
<VirtualHost *:888>
    ServerName domain.tld
    ServerAlias www.domain.tld

    DocumentRoot /var/www/project/public
    <Directory /var/www/project/public>
        AllowOverride All
        Order Allow,Deny
        Allow from All
    </Directory>

    # uncomment the following lines if you install assets as symlinks
    # or run into problems when compiling LESS/Sass/CoffeeScript assets
    # <Directory /var/www/project>
    #     Options FollowSymlinks
    # </Directory>

    ErrorLog /var/log/apache2/project_error.log
    CustomLog /var/log/apache2/project_access.log combined
</VirtualHost>

10-07 16:43