nginx.conf generator in Ruby
$ gem install nginx-conf
Code:
require 'nginx-conf'
c = nginx_conf do
user :www
http do
server do
listen 80
server_name 'foo.com'
end
server do
listen 443, :ssl
server_name 'bar.com'
end
end
end
puts c
Output:
user www;
http {
server {
listen 80;
server_name foo.com;
}
server {
listen 443 ssl;
server_name bar.com;
}
}
For more complex example, see examples directory.