Skip to content

Instantly share code, notes, and snippets.

@shivrajbadu
Created April 12, 2018 13:57
Show Gist options
  • Select an option

  • Save shivrajbadu/3b962f314c2a4c262a07a56e813f4944 to your computer and use it in GitHub Desktop.

Select an option

Save shivrajbadu/3b962f314c2a4c262a07a56e813f4944 to your computer and use it in GitHub Desktop.
OpenBSD: Nginx configuration
working_directory "/var/www/htdocs/html/demo"
# Unicorn PID file location
# pid "/path/to/pids/unicorn.pid"
pid "/var/www/htdocs/html/demo/pids/unicorn.pid"
demo$ cat /etc/nginx/nginx
nginx.conf nginxbackup nginxconfworking
demo$ cat /etc/nginx/nginx.conf
user www;
worker_processes 3;
pid /var/run/nginx.pid;
error_log /var/log/httpd.err error;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /var/log/httpd.log combined;
sendfile on;
tcp_nopush on;
keepalive_timeout 5;
server_name_in_redirect off;
client_max_body_size 30M;
client_body_buffer_size 512k;
gzip on;
gzip_vary on;
gzip_comp_level 9;
gzip_min_length 0;
gzip_proxied any;
gzip_disable "MSIE [1-6]\.";
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml applic
ation/xml+rss text/javascript application/javascript;
gzip_buffers 16 8k;
server {
listen 80;
server_name _;
keepalive_timeout 5;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host; proxy_redirect off;
# if you don't find the filename in the static files
# then request it from the unicorn server
if (!-f $request_filename) {
proxy_pass http://unicorn_server; break;
}
}
error_page 500 502 503 504 /500.html;
}
upstream unicorn_server {
# Path to Unicorn SOCK file which was already defined
# this is the socket we configured in unicorn.rb server
server unix:/var/www/htdocs/html/demo/tmp/unicorn.demo.sock fail_timeout=0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment