我使用nginx和docker在Symfony 3中启动了新的项目。它工作得很好,但我的资产不会在web/assets/bundle.js
中更新。我在更新后检查了我的bundle.js
,我看到了旧版本。
我删除了Symfony缓存和浏览器,但没有结果:
php bin/console assets:install
我的nginx配置:
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 2048;
multi_accept on;
use epoll;
}
http {
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 15;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log off;
error_log off;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
open_file_cache max=100;
}
和Symfony:
server {
listen 80; ## listen for ipv4; this line is default and implied
listen [::]:80 default_server ipv6only=on; ## listen for ipv6
server_name 127.0.0.1 0.0.0.0 myApp.local;
root /var/www/lfdw/web;
location ~ ^(.*)/(app|app_dev|app_test|config)\.php(/|$) {
fastcgi_pass php-upstream;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
error_log /var/log/nginx/symfony_error.log;
access_log /var/log/nginx/symfony_access.log;
}
你有什么想法吗?
谢谢!
答案 0 :(得分:0)
我在本地安装时遇到了这个问题,新资产根本无法安装。我所做的就是删除web中的整个bundle目录并重新生成资产。
另一种愚蠢的方法是删除您的供应商和composer install
如果你在prod,你可能只需要执行这个命令:
app/console assetic:dump --env=prod --no-debug
http://symfony.com/doc/current/deployment.html#e-dump-your-assetic-assets