Git Product home page Git Product logo

errbit's Introduction

Errbit on Nginx

Guide for people to setup their own errbit without using heroku. (Note: Clone errbit before following. We modified config/unicorn.rb to work in our setup)

The open source, self-hosted error catcher

  • Install MongoDB. Follow the directions here, then:
apt-get update
apt-get install mongodb-10gen
  • Install libxml and libcurl
apt-get install libxml2 libxml2-dev libxslt-dev libcurl4-openssl-dev
  • Install Bundler
gem install bundler

Deploying:

  • Copy config/deploy.example.rb to config/deploy.rb
  • Update the deploy.rb or config.yml file with information about your server
  • Setup server and deploy
cap deploy:setup deploy db:create_mongoid_indexes

(Note: The capistrano deploy script will automatically generate a unique secret token.)

It will deploy your app into /var/www/apps/errbit/

Make a copy of deploy.example.rb and add your server's username and password inside.

set :user, "root"
set :scm_passphrase, "xxxxxxxx"
set :use_sudo, true

Nginx configuration

Setup Nginx by doing

apt-get install nginx

sudo useradd -s /sbin/nologin -r nginx
sudo usermod -a -G web nginx
sudo chgrp -R web /var/www
sudo chmod -R 775 /var/www 

Sample nginx.conf

user nginx;
worker_processes 4;
pid /run/nginx.pid;

user nginx;
worker_processes 4;
pid /run/nginx.pid;

events {
  worker_connections 1024;
  # multi_accept on;
}

http {

  ##
  # Basic Settings
  ##

  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;
  keepalive_timeout 65;
  types_hash_max_size 2048;
  # server_tokens off;

  # server_names_hash_bucket_size 64;
  # server_name_in_redirect off;

  include /etc/nginx/mime.types;
  default_type application/octet-stream;

  ##
  # Logging Settings
  ##

  access_log /var/log/nginx/access.log;
  error_log /var/log/nginx/error.log;

  ##
  # Gzip Settings
  ##

  gzip on;
  gzip_disable "msie6";

  # gzip_vary on;
  # gzip_proxied any;
  # gzip_comp_level 6;
  # gzip_buffers 16 8k;
  # gzip_http_version 1.1;
  # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

  ##
  # nginx-naxsi config
  ##
  # Uncomment it if you installed nginx-naxsi
  ##

  #include /etc/nginx/naxsi_core.rules;

  ##
  # nginx-passenger config
  ##
  # Uncomment it if you installed nginx-passenger
  ##
  
  #passenger_root /usr;
  #passenger_ruby /usr/bin/ruby;

  ##
  # Virtual Host Configs
  ##

  include /etc/nginx/conf.d/*.conf;
  include /etc/nginx/sites-enabled/*;

}

Modify sites-enabled

Find default at /etc/nginx/sites-enabled/ and modify with the following

upstream unicorn_server {
 # This is the socket we configured in unicorn.rb
 server unix:/var/www/apps/errbit/current/tmp/sockets/unicorn.sock
 fail_timeout=0;
}

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

  root /var/www/apps/errbit/current/public;
  client_max_body_size 4G;
  # Make site accessible from http://localhost/
  server_name (your server);
  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 (!-f $request_filename) {
      proxy_pass http://unicorn_server;
      break;
    }
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.