Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
#############################################
$ 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;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.