Skip to content

Instantly share code, notes, and snippets.

@nesquena
Last active February 28, 2020 11:35
Show Gist options
  • Save nesquena/485042 to your computer and use it in GitHub Desktop.
Save nesquena/485042 to your computer and use it in GitHub Desktop.
nginx configuration
# /opt/nginx/conf/nginx.conf
# user nobody;
worker_processes 4;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15;
passenger_ruby /usr/local/bin/ruby;
passenger_max_pool_size 10;
passenger_pool_idle_time 0;
passenger_max_instances_per_app 0;
include mime.types;
default_type application/octet-stream;
access_log logs/access.log;
sendfile on;
keepalive_timeout 65;
tcp_nodelay on;
tcp_nopush on;
gzip on;
gzip_comp_level 2;
gzip_proxied any;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_disable "MSIE [1-6].(?!.*SV1)";
server {
listen 80;
server_name localhost;
root /var/apps/gomiso/current/public;
passenger_enabled on;
rails_spawn_method smart;
rack_env production;
location ~* \.(js|css|jpg|jpeg|gif|png)$ {
if (-f $request_filename) {
expires max;
break;
}
}
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# root html;
# }
}
server {
listen 443;
server_name **secret_and_stuff**;
root /var/apps/gomiso/current/public;
passenger_enabled on;
ssl on;
ssl_certificate /opt/nginx/ssl/certs/server.crt;
ssl_certificate_key /opt/nginx/ssl/private/server.key;
# needed for HTTPS
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect false;
proxy_max_temp_file_size 0;
location ~* \.(js|css|jpg|jpeg|gif|png)$ {
if (-f $request_filename) {
expires max;
break;
}
}
rack_env production;
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# root html;
# }
}
}
#user nobody;
worker_processes 4;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15;
passenger_ruby /usr/local/bin/ruby;
passenger_max_pool_size 10;
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;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
tcp_nodelay on;
gzip on;
gzip_comp_level 2;
gzip_proxied any;
server {
listen 80;
server_name localhost;
root /var/apps/gomiso/current/public;
passenger_enabled on;
rails_spawn_method smart;
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment