Class: Nginx::Accel
- Inherits:
-
Object
- Object
- Nginx::Accel
- Defined in:
- lib/shared_infrastructure/nginx/accel.rb
Instance Attribute Summary collapse
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#location_directory ⇒ Object
readonly
Returns the value of attribute location_directory.
Instance Method Summary collapse
- #alias_string ⇒ Object
-
#initialize(location_directory, domain: nil) ⇒ Accel
constructor
A new instance of Accel.
- #location ⇒ Object
- #proxy_set_header(domain_name) ⇒ Object
Constructor Details
#initialize(location_directory, domain: nil) ⇒ Accel
Returns a new instance of Accel.
7 8 9 10 |
# File 'lib/shared_infrastructure/nginx/accel.rb', line 7 def initialize(location_directory, domain: nil) @domain = domain @location_directory = location_directory.chomp("/").reverse.chomp("/").reverse end |
Instance Attribute Details
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
12 13 14 |
# File 'lib/shared_infrastructure/nginx/accel.rb', line 12 def domain @domain end |
#location_directory ⇒ Object (readonly)
Returns the value of attribute location_directory.
12 13 14 |
# File 'lib/shared_infrastructure/nginx/accel.rb', line 12 def location_directory @location_directory end |
Instance Method Details
#alias_string ⇒ Object
14 15 16 |
# File 'lib/shared_infrastructure/nginx/accel.rb', line 14 def alias_string File.join(domain.root, location_directory).to_s end |
#location ⇒ Object
18 19 20 |
# File 'lib/shared_infrastructure/nginx/accel.rb', line 18 def location "/__x_accel" end |
#proxy_set_header(domain_name) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/shared_infrastructure/nginx/accel.rb', line 22 def proxy_set_header(domain_name) [ " proxy_set_header X-Sendfile-Type X-Accel-Redirect;", " proxy_set_header X-Accel-Mapping #{alias_string}/=#{location}/;" ].join("\n") end |