I am working on Ruby on Rails app. I am using Vagrant and Chef. I am trying to configure Nginx as my web server to work on HTTPS.
I am more than sure that I am missing something in my Nginx configuration file. Here are my Nginx configuration files:
/etc/nginx/nginx.conf:
user www-data;
worker_processes 1;
daemon off;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_vary off;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/rss+xml application/atom+xml text/javascript application/javascript application/json text/mathml;
gzip_min_length 1000;
gzip_disable "MSIE [1-6]\.";
server_names_hash_bucket_size 64;
types_hash_max_size 2048;
types_hash_bucket_size 64;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
/etc/nginx/sites-enabled/olympus:
upstream olympus {
server unix:///tmp/olympus.sock;
}
server {
listen 4430 default deferred;
listen [::]:4430;
listen 8080;
listen [::]:8080;
server_name: *.olympus.dev;
add_header Strict-Transport-Security max-age=31104000;
ssl on;
ssl_certificate /vagrant/.ssl/olympus.crt;
ssl_certificate_key /vagrant/.ssl/olympus.key;
root /vagrant/public;
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#all requests are sent to the UNIX socket
proxy_pass http://olympus;
}
}
Port-forwarding config from Vagrantfile:
config.vm.network :forwarded_port, guest: 8080, host: 80
config.vm.network :forwarded_port, guest: 4430, host: 443
Here is how I run Puma
bundle exec puma -b unix:///tmp/olympus.sock
Puma starting in single mode...
* Version 2.9.0 (ruby 2.1.2-p95), codename: Team High Five
* Min threads: 0, max threads: 16
* Environment: development
* Listening on unix:///tmp/olympus.sock
Use Ctrl-C to stop
Here is the error I get when I try to curl https://olympus.dev/
:
curl: (7) Failed connect to olympus.dev:443; Connection refused