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 '6.0.3.4'
Server: AWS (EC2)
web Server;Nginx
Application Server: Unicorn
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.
user_controller.rb
Class UsersController</pre>
<pre><code>routing
Rails.application.routes.draw do
:
devise_for: users
post'/ users/guest_sign_in', to:'users # new_guest'
:
:
end
Nginx
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
Related articles
- javascript - how to eliminate can not find'fb' error
- i want to eliminate the parse error of windows batch
- python 3x - python i want to eliminate the error when outputting the average temperature in tokyo
- javascript - i'm making tetris with js, but i don't know how to resolve the error
- javascript - i want to use gas functions in vue components
- javascript - i want to save the data of the duplicated form
- javascript - i want to get localstorage in nextjs
- javascript - i want to get spreadsheet data in json using gus
- javascript - i want to pass the url with the get method
- java - i want to eliminate the error that occurs when starting an application that uses jsonic
- javascript - i want to display the progress with ajax xhr
- javascript - i want to handle html data attribute with js
- javascript - i want to reduce the hp gauge
- javascript - i want to eliminate the gaps in the character ruled lines with css
- javascript - i want to use the js code published on another site, but i get an error
- javascript - i want to add forms side by side with appendchild
- javascript - i want to get the second level of the json file
- javascript - i got the error these relative modules were not found while using vue router
- javascript - cors error when accessing the server set up by express from the server set up by create-react-app cannot be resolve
- python - you may need to restart the kernel to use updated packages error
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- javascript - how to check if an element exists in puppeteer
- sh - 'apt-get' is not recognized as an internal or external command, operable program or batch file
- i want to check the type of a shell script variable
- i want to call a child component method from a parent in vuejs
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 /.