Class: Nginx::RailsServer

Inherits:
Server
  • Object
show all
Defined in:
lib/shared_infrastructure/nginx/server.rb

Instance Attribute Summary

Attributes inherited from Server

#domain

Instance Method Summary collapse

Methods inherited from Server

#initialize

Constructor Details

This class inherits a constructor from Nginx::Server

Instance Method Details

#root_directoryObject



35
36
37
# File 'lib/shared_infrastructure/nginx/server.rb', line 35

def root_directory
  File.join(domain.site_root, "public")
end

#to_s(level = 0) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/shared_infrastructure/nginx/server.rb', line 39

def to_s(level = 0)
  [
    super(level),
    Lines.new(
      "# http://stackoverflow.com/a/11313241/3109926 said the following",
      "# is what serves from public directly without hitting Puma",
      "root #{root_directory};",
      "try_files $uri/index.html $uri @#{domain.domain_name};",
      "error_page 500 502 503 504 /500.html;",
      "client_max_body_size 4G;",
      "keepalive_timeout 10;"
    ).format(level)
  ].join("\n\n")
end