diff --git a/config/nginx.conf b/config/nginx.conf new file mode 100644 index 0000000..0e3d2ea --- /dev/null +++ b/config/nginx.conf @@ -0,0 +1,14 @@ +server { + listen pm.localhots.xxx:80; + server_name pm.localhots.xxx; + root /home/www/apps/pastemaster/current; + + location ^~ /public/ { + gzip_static on; + add_header Cache-Control public; + } + + try_files $uri; + client_max_body_size 10M; + keepalive_timeout 10; +} diff --git a/config/unicorn.rb b/config/unicorn.rb new file mode 100644 index 0000000..bd8a01c --- /dev/null +++ b/config/unicorn.rb @@ -0,0 +1,9 @@ +working_directory '/home/www/apps/pastemaster/current' +worker_processes 2 +timeout 10 + +listen '/tmp/pastemaster.unicorn.sock', backlog: 64 +pid '/tmp/pastemaster.unicorn.pid' + +stderr_path '/dev/null' +stdout_path '/dev/null' diff --git a/pastemaster.rb b/pastemaster.rb index 13b26da..dcc39d1 100644 --- a/pastemaster.rb +++ b/pastemaster.rb @@ -27,8 +27,11 @@ class Pastemaster < Sinatra::Application set :server, 'unicorn' set :public_folder, 'public' set :views, File.expand_path('../app/views', __FILE__) + set :slim, pretty: true register Sinatra::AssetPack + use ErrorPages + helpers ErrorPages::Forbidden assets do serve '/assets/js', from: 'app/assets/js' @@ -48,11 +51,6 @@ class Pastemaster < Sinatra::Application css_compression :simple end - set :slim, pretty: true - - use ErrorPages - helpers ErrorPages::Forbidden - get '/' do @syntaxes = CONFIG.syntaxes_map