public
Created

  • Download Gist
gistfile1.txt
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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
#############################################
$ nginx -V
nginx version: nginx/0.8.53
TLS SNI support enabled
configure arguments: --prefix=/usr/local/Cellar/nginx/0.8.53 --with-http_ssl_module --with-pcre --conf-path=/usr/local/etc/nginx/nginx.conf --pid-path=/usr/local/var/run/nginx.pid --lock-path=/usr/local/var/nginx/nginx.lock
 
#############################################
$ sudo lsof -Pni -a -c nginx
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 8509 root 9u IPv4 0x08bfd6b0 0t0 TCP *:8080 (LISTEN)
nginx 8509 root 10u IPv4 0x08c00740 0t0 TCP *:80 (LISTEN)
nginx 8511 nobody 9u IPv4 0x08bfd6b0 0t0 TCP *:8080 (LISTEN)
nginx 8511 nobody 10u IPv4 0x08c00740 0t0 TCP *:80 (LISTEN)
 
#############################################
$ ps axww | grep nginx
8509 ?? Ss 0:00.01 nginx: master process /usr/local/Cellar/nginx/0.8.53/sbin/nginx -g daemon off;
8511 ?? S 0:00.01 nginx: worker process
 
#############################################
$ ls -la /usr/local/etc/nginx/server.crt
-rw-r--r-- 1 saimon staff 1,3K 29 nov 12:17 /usr/local/etc/nginx/server.crt
 
$ ls -la /usr/local/etc/nginx/server.key
-rw-r--r-- 1 saimon staff 1,6K 29 nov 12:17 /usr/local/etc/nginx/server.key
 
#############################################
$ ping myapp.local
PING myapp.local (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.062 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.164 ms
 
#############################################
#/usr/local/etc/nginx/nginx.config:
 
#user nobody;
worker_processes 1;
 
events {
worker_connections 1024;
}
 
 
http {
include mime.types;
default_type application/octet-stream;
 
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
 
#access_log logs/access.log main;
 
sendfile on;
#tcp_nopush on;
 
#keepalive_timeout 0;
keepalive_timeout 65;
 
gzip on;
 
include /usr/local/etc/nginx/sites-enabled/*;
}
 
#############################################
#/usr/local/etc/nginx/sites-enabled/myapp
#:set filetype=apache
 
upstream mongrel {
server 127.0.0.1:3000;
}
 
server {
listen 80;
server_name myapp.local;
 
access_log /Users/saimon/Development/Clients/myapp/log/myapp.access.log main;
error_log /Users/saimon/Development/Clients/myapp/log/myapp.error.log debug;
root /Users/saimon/Development/Clients/myapp/public;
 
 
# Set the max size for file uploads to 50Mb
client_max_body_size 50M;
 
if (-f $document_root/maintenance.html) {
rewrite ^(.*)$ /maintenance.html
last;
}
 
 
location / {
proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded_Proto https;
proxy_set_header X-Forwarded_Proto http;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_max_temp_file_size 0;
 
if (-f $request_filename) {
break;
}
 
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html;
break;
}
 
if (!-f $request_filename) {
proxy_pass http://mongrel;
break;
}
}
 
location /assets/ {
internal;
root /Users/saimon/Development/Clients/myapp/;
}
 
error_page 500 502 503 504 /500.html;
location = /500.html {
root /Users/saimon/Development/Clients/myapp/public;
}
}
 
server {
server_name myapp.local;
listen 127.0.0.1:443;
ssl on;
ssl_certificate /usr/local/etc/nginx/server.crt;
ssl_certificate_key /usr/local/etc/nginx/server.key;
#ssl_session_cache shared:SSL.cache:10m;
 
access_log /Users/saimon/Development/Clients/myapp/log/myappssl.access.log main;
error_log /Users/saimon/Development/Clients/myapp/log/myappssl.error.log debug;
root /Users/saimon/Development/Clients/myapp/public;
 
 
# Set the max size for file uploads to 50Mb
client_max_body_size 50M;
 
if (-f $document_root/maintenance.html) {
rewrite ^(.*)$ /maintenance.html
last;
}
 
 
location / {
proxy_set_header X-Real-IP $remote_addr;
 
proxy_set_header X-Forwarded_Proto https;
#proxy_set_header X-Forwarded_Proto http;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_max_temp_file_size 0;
 
if (-f $request_filename) {
break;
}
 
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html;
break;
}
 
if (!-f $request_filename) {
proxy_pass http://mongrel;
break;
}
}
 
location /assets/ {
internal;
root /Users/saimon/Development/Clients/myapp/;
}
 
error_page 500 502 503 504 /500.html;
location = /500.html {
root /Users/saimon/Development/Clients/myapp/public;
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.