nginx-config 0.8.2 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 22bae4ebcb8eaf5a6e22856b92e7b69e17258708
4
+ data.tar.gz: b726ffd0205cd9cc816f6cc76ba36c942cbd0d60
5
+ SHA512:
6
+ metadata.gz: 63c4deb6683bcb9be2c4ea1e90ec791dba3bd19a793ea37fd221ac9c31d257ad690af09986c55bfe73af23dd52d4df395a5ed6224bdcbfc3b753913dc3e54a45
7
+ data.tar.gz: 084886143234c2114f0417aa16a48dacbdbc0e50e4eb3cd7e6ffb8707ed69905b055afce0a47b2cbf01092efa67a34e9bcaaca6861ecaf18845094f0202cdaab
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Nginx::Config
2
2
 
3
- Gem implement generator for generate config file for unicorn server instance for nginx
3
+ Gem contains a generator to create virtual hosts config unicorn instance for server nginx
4
4
 
5
5
  ## Installation
6
6
 
@@ -10,7 +10,7 @@ Add this line to your application's Gemfile:
10
10
 
11
11
  And then execute:
12
12
 
13
- $ bundle
13
+ $ bundle install
14
14
 
15
15
  Or install it yourself as:
16
16
 
@@ -18,6 +18,7 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
+ run rails generate nginx_unicorn_vhost <server_name> <site_domain>
21
22
 
22
23
 
23
24
  ## Contributing
@@ -1,32 +1,7 @@
1
1
  class NginxUnicornVhostGenerator < Rails::Generators::NamedBase
2
+ source_root File.expand_path("../templates", __FILE__)
2
3
  argument :domain, :type => :string, :required => true, :desc => "site's domain"
3
4
  def create_instance
4
- create_file "config/#{name}.vhost",
5
- "upstream #{name}_server {
6
- server unix:/var/www/#{name}/shared/unicorn.sock fail_timeout=0;
7
- }
8
-
9
- server {
10
- listen 80 default deferred;
11
-
12
- client_max_body_size 1G;
13
- server_name #{domain};
14
- keepalive_timeout 5;
15
- root /var/www/#{name}/current/public;
16
- try_files $uri/index.html $uri.html $uri @myapp;
17
-
18
- location @myapp {
19
- proxy_pass http://#{name}_server;
20
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
21
- proxy_set_header Host $http_host;
22
- proxy_redirect off;
23
- }
24
-
25
- error_page 500 502 503 504 /500.html;
26
- location = /500.html {
27
- root /var/www/#{name}/current/public;
28
- }
29
- }
30
- "
5
+ template 'config.vhost.erb', "config/#{name}.vhost"
31
6
  end
32
7
  end
@@ -0,0 +1,32 @@
1
+ server unix:/var/www/<%= name %>/shared/unicorn.sock fail_timeout=0;
2
+ }
3
+
4
+ server {
5
+ listen 80;
6
+
7
+ client_max_body_size 1G;
8
+ server_name <%= domain %> www.<%= domain %>;
9
+ keepalive_timeout 5;
10
+ root /var/www/<%= name %>/current/public;
11
+ try_files $uri/index.html $uri.html $uri @myapp;
12
+
13
+ location @myapp {
14
+ proxy_pass http://<%= name %>_server;
15
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
16
+ proxy_set_header Host $http_host;
17
+ proxy_redirect off;
18
+ }
19
+
20
+ location ~ ^/(assets)/ {
21
+ root /var/www/<%= name %>/current/public;
22
+ gzip_static on; # to serve pre-gzipped version
23
+ expires max;
24
+ add_header Cache-Control public;
25
+ }
26
+
27
+
28
+ error_page 500 502 503 504 /500.html;
29
+ location = /500.html {
30
+ root /var/www/<%= name %>/current/public;
31
+ }
32
+ }
@@ -1,5 +1,5 @@
1
1
  module Nginx
2
2
  module Config
3
- VERSION = "0.8.2"
3
+ VERSION = "0.9.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,60 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nginx-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
5
- prerelease:
4
+ version: 0.9.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - max-konin
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-27 00:00:00.000000000 Z
11
+ date: 2014-09-30 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
- requirement: &78468900 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.3'
22
20
  type: :development
23
21
  prerelease: false
24
- version_requirements: *78468900
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: rake
27
- requirement: &78468630 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - '>='
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
33
34
  type: :development
34
35
  prerelease: false
35
- version_requirements: *78468630
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: yard
38
- requirement: &78468280 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
45
  - - ~>
42
46
  - !ruby/object:Gem::Version
43
47
  version: 0.7.5
44
48
  type: :development
45
49
  prerelease: false
46
- version_requirements: *78468280
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.7.5
47
55
  - !ruby/object:Gem::Dependency
48
56
  name: rails
49
- requirement: &78467890 !ruby/object:Gem::Requirement
50
- none: false
57
+ requirement: !ruby/object:Gem::Requirement
51
58
  requirements:
52
- - - ! '>='
59
+ - - '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: 3.2.0
55
62
  type: :development
56
63
  prerelease: false
57
- version_requirements: *78467890
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: 3.2.0
58
69
  description: Generate unicorn vhost for nginx
59
70
  email:
60
71
  - mk@kernel-corp.com
@@ -68,33 +79,33 @@ files:
68
79
  - README.md
69
80
  - Rakefile
70
81
  - lib/generators/nginx_unicorn_vhost_generator.rb
82
+ - lib/generators/templates/config.vhost.erb
71
83
  - lib/nginx/config.rb
72
84
  - lib/nginx/config/version.rb
73
85
  - nginx-config.gemspec
74
86
  homepage: ''
75
87
  licenses:
76
88
  - MIT
89
+ metadata: {}
77
90
  post_install_message:
78
91
  rdoc_options: []
79
92
  require_paths:
80
93
  - lib
81
94
  required_ruby_version: !ruby/object:Gem::Requirement
82
- none: false
83
95
  requirements:
84
- - - ! '>='
96
+ - - '>='
85
97
  - !ruby/object:Gem::Version
86
98
  version: '0'
87
99
  required_rubygems_version: !ruby/object:Gem::Requirement
88
- none: false
89
100
  requirements:
90
- - - ! '>='
101
+ - - '>='
91
102
  - !ruby/object:Gem::Version
92
103
  version: '0'
93
104
  requirements: []
94
105
  rubyforge_project:
95
- rubygems_version: 1.8.11
106
+ rubygems_version: 2.2.2
96
107
  signing_key:
97
- specification_version: 3
108
+ specification_version: 4
98
109
  summary: Generate unicorn vhost for nginx
99
110
  test_files: []
100
111
  has_rdoc: