apache - Ubuntu 14.4.01 子域上的 Symfony2 - 缺少 Assets

标签 apache .htaccess symfony ubuntu plesk

不知何故,路由不了解从哪里获取我的 Assets ,它缺少基本演示的 3 个 css 文件:

http://sub. domain.ext/bundles/framework/css/structure.css
http://sub.domain.ext/bundles/framework/css/body.css
http://sub.domain.ext/bundles/framework/css/exception.css

服务器运行 Ubuntu 并安装了 Plesk。

等等/var/www/vhosts/system/sub.domain.ext/conf/vhost.conf

我已经告诉服务器寻找我的项目:
ServerName sub.domain.ext
ServerAlias www.sub.domain.ext

DocumentRoot /var/www/vhosts/domain.ext/sub.domain.ext/projectmanagement/web
<Directory /var/www/vhosts/domain.ext/sub.domain.ext/projectmanagement/web>
    # enable the .htaccess rewrite
    AllowOverride All
    Order allow,deny
    Allow from All
</Directory>
ErrorLog /var/log/apache2/project_error.log
CustomLog /var/log/apache2/project_acces.log combined

我还尝试将模板 -> assets_base_url 添加到 config.yml 但没什么重要的,我继续获取丢失的 Assets 。

如果有人以前有过子域和 symfony2 的经验,请告诉我秘诀以使其正常工作

最佳答案

您可能想要检查的 list

  • 您是否运行了命令 php app/console assets:install确保 Assets 已安装且可用
  • 我不确定您如何在 View / Twig 中调用 Assets ,但如果您使用 {{ assets_url }} 那么您还需要运行命令 php app/console assetic:dump --env=prod --no-debug这会将 Assets 物理放置在 web 文件夹中以在生产环境中使用。
  • 如果您以这种方式包含样式表{% stylesheets 'bundles/bundlename/css/*'%}然后记得添加cssrewrite喜欢 {% stylesheets 'bundles/bundlename/css/*' filter='cssrewrite' %}

  • 我希望这有帮助

    关于apache - Ubuntu 14.4.01 子域上的 Symfony2 - 缺少 Assets ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28511316/

    相关文章:

    php - 如何仅在服务器调用 PHP 脚本时运行它

    php - 熟悉 XAMPP

    .htaccess - web.config 中的 URL 重写不适用于子目录中的 Slim PHP API

    php - .htaccess 文件更改 url 字符串在某些页面上不起作用

    serialization - 哪些属性必须在 Symfony 2 User 类中序列化/反序列化?

    php - 学说/Symfony : Entity with non-mapped property

    php - LAMP 堆栈的 PHP 不工作 (Ubuntu 13.10/Apache 2.4.6)

    android - java.lang.NoSuchFieldError : org. apache.http.message.BasicHeaderValueFormatter.INSTANCE android

    php - .htaccess 错误 : Invalid command 'AuthGroupFile'

    php - 在 symfony2 中调用 transactionDate 时查询没有返回结果如何解决?