Skip to content

Instantly share code, notes, and snippets.

@dopa
Last active December 14, 2015 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dopa/5040472 to your computer and use it in GitHub Desktop.
Save dopa/5040472 to your computer and use it in GitHub Desktop.
Rails 3 Passenger NGINX Site Config
# www to non-www redirect -- duplicate content is BAD:
# https://github.com/h5bp/html5-boilerplate/blob/5370479476dceae7cc3ea105946536d6bc0ee468/.htaccess#L362
# Choose between www and non-www, listen on the *wrong* one and redirect to
# the right one -- http://wiki.nginx.org/Pitfalls#Server_Name
#server {
# don't forget to tell on which port this server listens
# listen 80;
# listen on the www host
# server_name www.example.com;
# and redirect to the non-www host (declared below)
# return 301 $scheme://example.com$request_uri;
#}
server {
listen 80 default_server deferred; # for Linux
# note! if you have multiple sites running on one server, only one
# can have "default_server" and "deferred" or nginx will not start
# listen 80 default_server accept_filter=httpready; # for FreeBSD
# listen 192.168.1.50:80; # bind to a specific IP
# If your nginx service won't start, try tail -f /opt/nginx/error.log
# The host name to respond to
server_name example.com;
# Path for static files
root /var/www/production/appname/current/public; #add 'current' if using Capistrano for deployment
# Enable Passenger
passenger_enabled on;
#Specify a charset
charset utf-8;
# Custom 404 page
error_page 404 /404.html;
# Include the component config parts for h5bp
#include conf/h5bp.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment