前提・実現したいこと
・問題:
1.本番環境でcssが反映されない(HTMLのみ表示)
2.リロードに異様に時間がかかる
・現状:
AWSにてEC2にデプロイし、webサーバーはNginx、アプリケーションサーバーはpuma、データベースはRDSを使用しています。
恐らくリロードに時間がかかりすぎてcssを読めていないのかと考えています。
ただリロードに時間がかかる原因がわからない状況です。
発生している問題・エラーメッセージ
該当のソースコード
etc/nginx/conf.d/xxx.conf
1pstream puma { 2 server unix:///home/ec2-user/アプリ名/tmp/sockets/puma.sock; 3} 4server { 5 listen 80; 6 server_name ELASTIC IP; 7 root /home/ec2-user/アプリ名/public; 8 9 access_log /var/log/nginx/access.log main; 10 error_log /var/log/nginx/error.log; 11 12 sendfile off; 13 tcp_nopush on; 14 tcp_nodelay on; 15 keepalive_timeout 65; 16 types_hash_max_size 2048; 17 client_max_body_size 100M; 18 include /etc/nginx/mime.types; 19 20 location / { 21 proxy_pass http://puma; 22 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 23 proxy_set_header Host $http_host; 24 proxy_set_header X-Real-IP $remote_addr; 25 proxy_redirect off; 26 proxy_connect_timeout 130; 27 } 28 29 30 location ^~ /assets/ { 31 gzip_static on; 32 expires max; 33 add_header Cache-Control public; 34 root /home/ec2-user/サイト名/public; 35 } 36 37 38 location /cable { 39 proxy_pass http://0.0.0.0:3000/cable; 40 proxy_http_version 1.1; 41 proxy_set_header Upgrade websocket; 42 proxy_set_header Connection Upgrade; 43 proxy_set_header X-Real-IP $remote_addr; 44 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 45 proxy_set_header Host $host; 46 } 47} 48
試したこと
・sendfile off;
・config.assets.compile = true
・bundle exec rake assets:precompile RAILS_ENV=production
補足情報(FW/ツールのバージョンなど)
初学者で大変未熟者なので分かりづらい部分も多いかと思いますが、
お手隙の際に教えていただけないでしょうか。
何卒宜しくお願い致します。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。