Ruby on Rails应用程序使用Nginx上的Vagrant和Chef和HTPS - 站点无法加载

时间:2014-08-15 03:53:42

标签: nginx vagrant chef chef-solo puma

我正在开发Ruby on Rails应用程序。我正在使用Vagrant和Chef。我正在尝试将Nginx配置为我的Web服务器以使用HTTPS。

我更确信我在Nginx配置文件中遗漏了一些东西。这是我的Nginx配置文件:

/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的/ /奥林巴斯启用位点-:

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;
    }
}

来自 Vagrantfile的端口转发配置:

config.vm.network :forwarded_port, guest: 8080, host: 80
config.vm.network :forwarded_port, guest: 4430, host: 443

以下是我如何运行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

以下是我尝试curl https://olympus.dev/时出现的错误:

curl: (7) Failed connect to olympus.dev:443; Connection refused

0 个答案:

没有答案