발견되지 또한 Capistrano
성공적으로 응용 프로그램을 배포 할 수있게되었습니다. 앱 개발 중에도 작동합니다. Rails 5와 Ruby 2.3.1을 개발 및 생산에 사용하고 있습니다.nginx 오류! 당신이 찾고있는 페이지는 내가 Nginx와 푸마는이 튜토리얼을</p> <pre><code>https://www.sitepoint.com/deploy-your-rails-app-to-aws/ </code></pre> <p>을 다음과 AWS EC2를 사용하여 테스트 응용 프로그램을 구축하고
현재 개발중인 두 페이지가 있지만 프로덕션에서는 작동하지 않습니다. 생산에서
내가 대신 내 홈 페이지의
This is the default index.html page that is distributed with nginx on the Amazon Linux AMI. It is located in /usr/share/nginx/html.
을 얻고이 URL
http://ec2-54-226-156-103.compute-1.amazonaws.com/
를 사용하여.
그리고이 URL
http://ec2-54-226-156-103.compute-1.amazonaws.com/contacts
을 사용하고 때 나는이 문제를 해결하는 방법을 알고 케이하지 마십시오
nginx error!
The page you are looking for is not found.
Something has triggered missing webpage on your website. This is the default 404 error page for nginx that is distributed with the Amazon Linux AMI. It is located at /usr/share/nginx/html/404.html
You should customize this error page for your own site or edit the error_page directive in the nginx configuration file /etc/nginx/nginx.conf.
을 얻고있다.
다음은 Nginx의 설정 파일입니다.
cat /etc/nginx/nginx.conf
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
index index.html index.htm;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location/{
}
# redirect server error pages to the static page /40x.html
#
error_page 404 /404.html;
location = /40x.html {
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# Settings for a TLS enabled server.
#
# server {
# listen 443 ssl;
# listen [::]:443 ssl;
# server_name localhost;
# root /usr/share/nginx/html;
#
# ssl_certificate "/etc/pki/nginx/server.crt";
# ssl_certificate_key "/etc/pki/nginx/private/server.key";
# # It is *strongly* recommended to generate unique DH parameters
# # Generate them with: openssl dhparam -out /etc/pki/nginx/dhparams.pem 2048
# #ssl_dhparam "/etc/pki/nginx/dhparams.pem";
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 10m;
# ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# ssl_ciphers HIGH:SEED:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!RSAPSK:!aDH:!aECDH:!EDH-DSS-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!SRP;
# ssl_prefer_server_ciphers on;
#
# # Load configuration files for the default server block.
# include /etc/nginx/default.d/*.conf;
#
# location/{
# }
#
# error_page 404 /404.html;
# location = /40x.html {
# }
#
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }
# }
}
및
cat /etc/nginx/sites-available/default
upstream app {
# Path to Puma SOCK file, as defined previously
server unix:/home/deploy/contactbook/shared/tmp/sockets/puma.sock fail_timeout=0;
}
server {
listen 80;
server_name localhost;
root /home/deploy/contactbook/public;
try_files $uri/index.html $uri @app;
location/{
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Connection '';
proxy_pass http://app;
}
location ~ ^/(assets|fonts|system)/|favicon.ico|robots.txt {
gzip_static on;
expires max;
add_header Cache-Control public;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
제대로 작동하고 Nginx에이 응용 프로그램에서 페이지를 제공하는 응용 프로그램을 위해 이러한 Nginx의 설정을 수정하는 방법을 몰라? 이 어떤 도움이 될 수있는 경우
, 여기에 폴더/집에서 퓨마 설정 파일은/배포/contactbook/공유
cat puma.rb
#!/usr/bin/env puma
directory '/home/deploy/contactbook/current'
rackup "/home/deploy/contactbook/current/config.ru"
environment 'production'
pidfile "/home/deploy/contactbook/shared/tmp/pids/puma.pid"
state_path "/home/deploy/contactbook/shared/tmp/pids/puma.state"
stdout_redirect '/home/deploy/contactbook/shared/log/puma_error.log', '/home/deploy/contactbook/shared/log/puma_access.log', true
threads 0,8
bind 'unix:///home/deploy/contactbook/shared/tmp/sockets/puma.sock'
workers 0
prune_bundler
on_restart do
puts 'Refreshing Gemfile'
ENV["BUNDLE_GEMFILE"] = "/home/deploy/contactbook/current/Gemfile"
end
서버 이름을 server_name _으로 변경했습니다. 동일한 오류가 발생했습니다. –
server_name을 server_name ec2-54-226-156-103.compute-1.amazonaws.com으로 변경했으며 동일한 오류가 발생했습니다. –
나는 Nginx에 대해 매우 익숙하지만 내 직관은 "/ etc/nginx/sites-available/default"파일을 가져 오지 않고 사용하지 않는다고 말하고 있습니다. 실제로 "sites-available"폴더와 "default"파일은 Nginx 설치 프로그램이 생성하지 않았기 때문에 만들어졌습니다. –