The locally precompiled manifest file cannot be read from the AWS production environment.

Asked 5 months ago, Updated 5 months ago, 19 views

I couldn't understand the cause and got stuck, so I'd like to ask you a question.
The title is correct.

I am deploying to the server after running assembets:precompile locally, but I am having trouble because the manifest file is not reflected.
(Only images are reflected, but stylesheets and javascripts are not.)

Below are the things I have confirmed.

  • Deleting browser cache and Nginx cache, restarting Nginx, Unicorn, and checking operation in secret window
  • I've also changed the browser user agent to verify its operation
  • The contents of the manifest file are exactly the same
  • The developer tool has successfully called all associates and returned 200,304 status codes
  • css,javascript files directly link to verify correct path
  • In the local production environment, assets are reflected successfully
  • After downloading the file group locally to see if assocets are reflected,

↓ reflects css, but

<link rel="stylesheet" media="all" href="http://localhost:3000/assets/application-34ad617bfadb73ed23d5a75.cs"data-turbolinks-track="true">

↓ does not reflect css

<link rel="stylesheet" media="all" href="http://ec2-****"data-turbolinks-track="true">

This situation (both of them are exactly the same), except that the server is different between the local and AWS environments.We use WEBrick locally and Nginx+Unicorn in AWS environments.

Based on this, I thought that the setting of Nginx might be suspicious, so I have tried many things, but it has not been improved.The following are the settings for /etc/nginx/nginx.conf, the relevant settings for production.rb, and the operating environment:
Thank you for your advice.

  upstream unicorn {
    server unix: /tmp/unicorn.sock;
    server_name localhost;
    location / {
      if (-f$request_filename) {break;}
      proxy_set_header X-Real-IP$remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_pass http://unicorn;




  • Rails 4.2.0
  • Ruby 2.2.0
  • rbenv0.4.0
  • Unicorn 4.8.3
  • Nginx 1.6.2
  • MySQL 5.5.40
  • EC2 Amazon Linux AMI 2014.09.1 (HVM) (Production Machine)
  • Git (Repository Machine)

ruby-on-rails nginx aws unicorn

2022-09-30 11:39

1 Answers

It's not an answer, it's a question.


server_name localhost;

Therefore, I wonder if this conf is not used.
Does the server name match localhost?

Is there a possibility that other nginx.conf is starting?


You can see it even if you type the URL directly.

So it may not matter.
As part of the problem isolation, it would be good if you could confirm it.


You can infer that the html that rails render is incorrect, since you can see that you hit directly.

You may find the problem by looking at the links that rails on the server output.

2022-09-30 11:39

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.