/
config.erb
97 lines (88 loc) · 3.38 KB
/
config.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#####################################################
#
# !!!!!!! WARNING, READ THIS !!!!!!!
#
#
# The fact that Phusion Passenger uses Nginx
# internally is considered to be an implementation
# detail that the user should not bother with.
# We may arbitrarily replace the Nginx core with
# something else in the future.
#
# As such, we do not support any kind of custom
# Nginx configuration in Phusion Passenger Standalone.
# If you need additional Nginx modules or if you need
# special Nginx configuration or whatever then you
# should use Phusion Passenger for Nginx, NOT
# Phusion Passenger Standalone.
#
# You are strongly discouraged from editing this file
# and treating Phusion Passenger Standalone as an easy
# way to start Nginx. We will not provide any support
# for this.
#
#####################################################
master_process on;
worker_processes 1;
daemon on;
error_log '<%= @options[:log_file] %>' <% if debugging? %>info<% end %>;
pid '<%= @options[:pid_file] %>';
<% if @options[:user] %>user <%= @options[:user] %> <%= default_group_for(@options[:user]) %>;<% end %>
events {
worker_connections 1024;
}
http {
log_format debug '[$time_local] $msec "$request" $status conn=$connection sent=$bytes_sent body_sent=$body_bytes_sent';
include '<%= PhusionPassenger::RESOURCES_DIR %>/mime.types';
passenger_ruby <%= PlatformInfo.ruby_command %>;
passenger_root '<%= passenger_root %>';
passenger_abort_on_startup_error on;
passenger_user_switching off;
passenger_max_pool_size <%= @options[:max_pool_size] %>;
passenger_min_instances <%= @options[:min_instances] %>;
<% if @options[:user] %>passenger_default_user <%= @options[:user] %>;<% end %>
<% if debugging? %>passenger_log_level 2;<% end %>
<% if @options[:union_station_gateway_address] %>
union_station_gateway_address <%= @options[:union_station_gateway_address] %>;
union_station_gateway_port <%= @options[:union_station_gateway_port] %>;
union_station_gateway_cert -;
<% end %>
default_type application/octet-stream;
client_max_body_size 50m;
access_log off;
keepalive_timeout 60;
gzip on;
gzip_comp_level 3;
gzip_min_length 150;
gzip_proxied any;
gzip_types text/plain text/css application/javascript application/x-javascript;
<% if @apps.size > 1 %>
# Default server entry.
server {
listen <%= nginx_listen_address %>;
root '<%= LIBDIR %>/phusion_passenger/templates/standalone_default_root';
}
<% end %>
<% if @options[:ping_port] %>
server {
listen <%= nginx_listen_address(@options, true) %>;
root '<%= LIBDIR %>/phusion_passenger/templates/standalone_default_root';
}
<% end %>
<% for app in @apps %>
server {
listen <%= nginx_listen_address(app) %>;
server_name <%= app[:server_names].join(' ') %>;
root '<%= app[:root] %>/public';
passenger_enabled on;
rails_env <%= app[:env] %>;
passenger_spawn_method <%= app[:spawn_method] %>;
<% if app[:min_instances] %>passenger_min_instances <%= app[:min_instances] %>;<% end %>
<% if app[:union_station_key] %>
union_station_support on;
union_station_key <%= app[:union_station_key] %>;
<% end %>
}
passenger_pre_start http://<%= nginx_listen_address(app) %>;
<% end %>
}