在Nginx上安装symfony2无法加载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等.
请帮帮我!
提前Thnx
解决方法:
您必须执行以下命令才能将资产安装在Web目录中:
php app/console assets:install
标签:symfony-2-3,nginx,symfony 来源: https://codeday.me/bug/20191120/2046478.html