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

laravel项目没有用ApacheArtisan serve加载css工作正常

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

    我已经创建了一个Laravel项目,我以前用apache2部署过这个项目,效果很好。

    但是,在与 php artisan serve 一切正常。

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

    <VirtualHost *:80>
        ServerAdmin admin@project
        DocumentRoot /var/www/html/project/public/index.php
        ServerName example.com
        ServerAlias www.example.com
        DirectoryIndex index.php
    
        <Directory /var/www/html/project/public>
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>
    
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>
    
    1 回复  |  直到 7 年前
        1
  •  1
  •   architjn    7 年前

    在virtualhost配置中,您应该尝试使用

    <VirtualHost *:80>
        ServerAdmin admin@project
        DocumentRoot /var/www/html/project/public
        ServerName example.com
        ServerAlias www.example.com
        DirectoryIndex index.php
    
        <Directory /var/www/html/project/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>
    
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>
    

    public 文件夹来自 <Directory> 同时移除 index.php DocumentRoot .