Yesterday I was able to see default page like you see here.
But today I modified config for nginx to access my rails application which is running on unicorn and started getting 404.
/etc/nginx/nginx.conf
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
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;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
/etc/nginx/sites-available/default
upstream unicorn {
server unix:/tmp/unicorn.integrity_matters.sock fail_timeout=0;
}
server {
listen 80;
server_name localhost;
root /home/ubuntu/integrity_matters/current/public;
location ~ ^/assets/ {
gzip_static on;
expires max;
add_header Cache-Control 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://unicorn;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 20M;
keepalive_timeout 10;
}
MY_APP_ROOT/config/unicorn.rb
root = "/home/imdeploy/integrity_matters/current"
working_directory root
pid "#{root}/tmp/pids/unicorn.pid"
stderr_path "#{root}/log/unicorn.log"
stdout_path "#{root}/log/unicorn.log"
listen "/tmp/unicorn.integrity_matters.sock"
worker_processes 2
timeout 30
# Force the bundler gemfile environment variable to
# reference the capistrano "current" symlink
before_exec do |_|
ENV\["BUNDLE_GEMFILE"\] = File.join(root, 'Gemfile')
end][2]
I also verified that the security groups attached to EC2 allows 22, 80 and 443 ports. Please find attached security rules for EC2.
I restarted nginx and unicorn many times and verified that nginx and unicorn are running properly.
I also verified nginx access and error logs but could not see any activity there.
Please help,