What i am working on

I'm writing a personal application and an error occurred when deploying to production.

error contents
When I log in as a guest, the message "This page cannot be found" is displayed.
Error 404: There is a problem with the linked page
→ Error display: net :: ERR_ABORTED 404 (Not Found)


ruby '2.6.5'
rails ''
Server: AWS (EC2)
web Server;Nginx
Application Server: Unicorn

What went

From the verification screen, the following code that could be an error target was displayed.

In the HTML head element
<Script src = "/ packs/js/application-a1e7bfdb59418e304c0d.js" data-turbolinks-track = "reload"></script>

Based on this, we worked on two points.
(1) I tried to check and edit the above error target code, "/packs/js/application-a1e7bfdb59418e304c0d.js".
Could not find this file.

(2) From error 404, I once deleted the page code related to the link destination, but error 404 did not change.
It worked fine a few days ago, so I reverted the code as far as I can remember, but it still resulted in an error 404.

The code for guest login is also attached below.

Class UsersController</pre>
 Rails.application.routes.draw do
  devise_for: users
    post'/ users/guest_sign_in', to:'users # new_guest'
upstream app_server {
  Settings for linking with #Unicorn
  server unix: /var/www/appname/shared/tmp/sockets/unicorn.sock;
server {
  # port number
  listen 80;
  server_name Acquired domain;
  client_max_body_size 2g;
#The root directory when the connection came
  root/var/www/app name/current/public;
#Assets Settings applied when an access is made to a file (such as a CSS or JavaScript file)
  location ^ ~/assets/{
    gzip_static on;
    expires max;
    add_header Cache-Control public;
    root/var/www/app name/current/public;
  try_files $uri/index.html $uri @unicorn;
  location @unicorn {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http: // app_server;
  error_page 500 502 503 504 /500.html;

If i have any suggestions on how to deal with it, please give us some advice.
If there is any missing data, we will provide it.
This is a poor explanation, but please consider it.

  • Answer # 1

    The file is created public when you run webpack.
    It is not made with an editor.

    Will you run it with bundle exec assets: precompile?
    (The long string after application may change)
    And even if it can be done, if it is still 404
    Try defining/packs/in addition to location ^ ~/assets /.