从主页/主页导航到另一个页面时出现Nginx 404错误(Rails 5,AWS EC2)

时间:2016-09-21 16:48:46

标签: ruby-on-rails nginx amazon-ec2 passenger

导航到我的应用主页面中的链接页面时出现此错误。

我正在使用Nginx和Passenger

application/_header.html.erb文件中,我有这行链接:

<li><%= link_to 'Comments', comments_path, method: "get" %></li>

我在routes.rb中有哪些: root to: "application#index" resources :comments

我的/etc/nginx/sites-available/default

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /home/ubuntu/test-aws-deploy-with-git-ec2-rds/public;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

        server_name ec2-54-173-78-253.compute-1.amazonaws.com;

        location / {
                proxy_pass http://127.0.0.1:4000;
                proxy_http_version 1.1;
                proxy_buffering off;
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }
}

不知道为什么我无法在页面之间导航这个应用程序? 我是否需要指定此应用将使用的任何页面?

1 个答案:

答案 0 :(得分:1)

为此你需要在/ etc / nginx / sites-available / default

的下面注释
{{1}}

它的工作我也面临同样的问题。