Skip to content

Instantly share code, notes, and snippets.

@vishrayne
Created November 5, 2013 06:10
Show Gist options
  • Save vishrayne/7314659 to your computer and use it in GitHub Desktop.
Save vishrayne/7314659 to your computer and use it in GitHub Desktop.
nginx conf
nginx -V
************
nginx version: nginx/1.4.2
built by gcc 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-cc-opt=-Wno-error --add-module=/usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.10/ext/nginx --sbin-path=/usr/local/sbin/nginx --conf-path=/usr/local/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --with-http_stub_status_module --http-log-path=/var/log/nginx/access.log --with-http_realip_module --add-module=/usr/local/nginx/headers-more-nginx-module-0.18rc1
**************
nginx.conf
***********
user mobme;
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 /var/log/nginx/access.log main;
passenger_max_pool_size 30;
passenger_buffers 16 32k;
passenger_buffer_size 64k;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
# gzip
gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js;
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
# Disable headers which give out too much information
server_tokens off;
# Restrict XFS attack by disabling emebedding in IFrame
add_header X-Frame-Options DENY;
server_names_hash_bucket_size 64;
client_max_body_size 20m;
large_client_header_buffers 4 16k;
passenger_root /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.10;
passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.3-p194/ruby;
include /usr/local/nginx/sites-enabled/*;
}
*****************
$ cat sites-enabled/staging.mobileexpress.in.conf
server {
listen 80;
server_name staging.mobileexpress.in www.staging.mobileexpress.in;
rewrite ^ https://$server_name$request_uri? permanent;
}
*****************
$ cat sites-enabled/staging.mobileexpress.in.ssl.conf
server {
listen 443;
server_name staging.mobileexpress.in www.staging.mobileexpress.in;
root /home/mobme/public;
ssl on;
ssl_certificate ssl/mobileexpress.in.crt;
ssl_certificate_key ssl/mobileexpress.in.key;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers RC4:HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
# All ruby 1.9.3 apps
passenger_enabled on;
passenger_base_uri /registration-interface;
# all ruby 2 apps
passenger_base_uri /paytm-merchant;
location /paytm-merchant {
passenger_enabled on;
passenger_ruby /usr/local/rvm/wrappers/ruby-2.0.0-p247/ruby;
}
location /mobile-express-mpassbook-api {
proxy_pass http://127.0.0.1:8080/mobile-express-mpassbook-api;
proxy_read_timeout 300;
proxy_set_header Accept-Encoding "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
add_header Front-End-Https on;
proxy_redirect off;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment