在 nginx 上安装 symfony2 未加载 css

Install symfony2 on nginx not load css

我有问题,我想在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 等。 请帮帮我! 提前致谢

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

php app/console assets:install