在nginx上安装symfony2而不加载css

时间:2015-02-04 13:22:32

标签: symfony nginx symfony-2.3

我有一个问题,我想在nginx上安装symfony2,框架安装但是没有加载css,js,img。所以我只查看没有样式的主页。我的安装:

server {
listen 80;
server_name symfony.dev;
root /home/vagrant/Workspace/symfony/web;

access_log off;
error_log  /var/log/nginx/symfony.dev-error.log error;

location / {
    # try to serve file directly, fallback to app.php
    try_files $uri /app.php$is_args$args;
}

location ~ ^/(app|app_dev|config)\.php(/|$) {
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param HTTPS off;
}

}

我查看了/etc/nginx/nginx.conf,有:

include /etc/nginx/mime.types;

在mime.types中存在css,js等。 请帮帮我! Thnx提前

1 个答案:

答案 0 :(得分:3)

您必须执行此命令才能在Web目录中安装资产:

php app/console assets:install