Nginx: Difference between revisions
(5 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
== Current Info == | == Current Info == | ||
https://www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html | https://www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html | ||
=== SECRET_KEY_BASE in Passenger 5.0 === | |||
Need this line in your nginx site config: | |||
<pre> | |||
passenger_env_var SECRET_KEY_BASE d324db3c6eb35e2e7... ; | |||
</pre> | |||
NOTE the semicolon at the end. | |||
=== Passenger pre start === | |||
add something like this to the end of the sites config, after (outside of) the server block: | |||
<pre> | |||
passenger_pre_start http://mysite.com; | |||
</pre> | |||
== SSL == | |||
Use this: | |||
https://mozilla.github.io/server-side-tls/ssl-config-generator/ | |||
To set up Diffie-Hellman parameter: | |||
<pre> | |||
openssl dhparam -out dhparam.pem 4096 | |||
</pre> | |||
OCSP Stapling is probably not worth it. | |||
== Restart Rails app in Passenger == | == Restart Rails app in Passenger == | ||
Line 18: | Line 43: | ||
passenger-memory-stats | passenger-memory-stats | ||
</pre> | </pre> | ||
== Old Info == | == Old Info == |
Latest revision as of 17:20, 10 December 2015
Current Info
https://www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html
SECRET_KEY_BASE in Passenger 5.0
Need this line in your nginx site config:
passenger_env_var SECRET_KEY_BASE d324db3c6eb35e2e7... ;
NOTE the semicolon at the end.
Passenger pre start
add something like this to the end of the sites config, after (outside of) the server block:
passenger_pre_start http://mysite.com;
SSL
Use this:
https://mozilla.github.io/server-side-tls/ssl-config-generator/
To set up Diffie-Hellman parameter:
openssl dhparam -out dhparam.pem 4096
OCSP Stapling is probably not worth it.
Restart Rails app in Passenger
touch /webapps/mycook/tmp/restart.txt
Passenger will automatically restart the application during the next request.
Useful Passenger Tools
passenger-status
passenger-memory-stats
Old Info
Install Nginx with Passenger
Since we’ll be using Nginx for serving our application, we’re going to install it using the Passenger installer. Nginx modules need to be compiled into nginx, unlike Apache, so we can’t just install the package from the PPA.
sudo gem install passenger sudo passenger-install-nginx-module # Choose "download, compile, and install Nginx for me" # Accept defaults for any other questions it asks you
Upgrading Nginx
sudo gem update passenger sudo passenger-install-nginx-module # go ahead and install latest nginx with ruby support
This will overwrite existing files in place. Then you will need to update the "passenger_root" directive in nginx.conf to point to the latest passenger gem.
Confirm server version with this:
/opt/nginx/sbin/nginx -v