Skip to content

Instantly share code, notes, and snippets.

@drscream
Last active August 29, 2015 13:57
Show Gist options
  • Save drscream/9488029 to your computer and use it in GitHub Desktop.
Save drscream/9488029 to your computer and use it in GitHub Desktop.
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name otp.sh www.otp.sh;
return 301 https://otp.sh$request_uri;
}
server {
listen 443 default_server ssl;
listen [::]:443 default_server ssl;
server_name otp.sh;
location / {
root /var/www/otp-sh/public;
index index.html index.htm;
}
ssl_certificate ssl/otp.pem;
ssl_certificate_key ssl/otp.pem;
}
upstream otp-api {
server unix:/tmp/otp-api.sock;
}
server {
listen 80;
listen [::]:80;
server_name api.sh
return 301 https://api.otp.sh$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name api.otp.sh;
location / {
proxy_pass http://otp-api;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
ssl_certificate ssl/otp.pem;
ssl_certificate_key ssl/otp.pem;
}
user www www;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include /opt/local/etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
include sites/*.conf;
}
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="otp-api">
<service name="site/otp-api" type="service" version="1">
<create_default_instance enabled="true"/>
<single_instance/>
<dependency name="network" grouping="require_all" restart_on="refresh" type="service">
<service_fmri value="svc:/milestone/network:default"/>
</dependency>
<dependency name="filesystem" grouping="require_all" restart_on="refresh" type="service">
<service_fmri value="svc:/system/filesystem/local"/>
</dependency>
<method_context working_directory="/var/www/otp-sh">
<method_credential user="otp-sh" group="other" privileges='basic,net_privaddr' />
<method_environment>
<envvar name="PATH" value="/usr/local/bin:/usr/bin:/usr/sbin:/bin"/>
<envvar name="SITE_SECRET" value="oJahfae0aif5la8iewey"/>
<envvar name="PORT" value="/tmp/otp-api.sock"/>
</method_environment>
</method_context>
<exec_method
type="method"
name="start"
exec="/opt/local/bin/node bin/www"
timeout_seconds="60"/>
<exec_method
type="method"
name="stop"
exec=":kill"
timeout_seconds="60"/>
<property_group name="startd" type="framework">
<propval name="duration" type="astring" value="child"/>
<propval name="ignore_error" type="astring" value="core,signal"/>
</property_group>
<property_group name="application" type="application">
</property_group>
<stability value="Evolving"/>
<template>
<common_name>
<loctext xml:lang="C">node.js otp api service</loctext>
</common_name>
</template>
</service>
</service_bundle>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment