I used the 1-click Ubuntu-Nginx-Unicorn-Rails install option and have my app up and running. I’m trying to configure my server to support SSL on a couple of things like sign-in and registration. I have my certificate installed in /etc/nginx/ssl. I’ve read a lot about adding certain code to the server block but being new to this, no one defines where it is for someone like me.
I’m assuming it is adding code to nginx.conf. If that is correct, is this the proper way to add support for SSL to my Rails app or should this be somewhere else in another file? I’m making this guess after reading about SSL configuration on Nginx.org
user www-data; worker_processes 4; pid /var/run/nginx.pid;
events { worker_connections 1024; }
http {
server { listen 443; server_name mydomain.com; ssl on; ssl_certificate /etc/nginx/ssl/www.mydomain.com.crt; ssl_certificate_key /etc/nginx/ssl/www.mydomain.com.key; ssl_protocols SSLv2 SSLv3 TLSv1; ssl_ciphers ALL:-ADH:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP; ssl_session_cache shared:SSL:10m;
root /home/rails/app/public;
location ^~ /assets/ { gzip_static on; expires max; add_header Cache-Control public; }
try_files $uri/index.html $uri @unicorn; location @unicorn { 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 https; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://unicorn; }
error_page 500 502 503 504 /500.html; client_max_body_size 4G; keepalive_timeout 10; }
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
gzip_types text/plain text/xml text/css text/comma-separated-values;
upstream app_server { server 127.0.0.1:8080 fail_timeout=0; }
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
This question was answered by @RedMagnum30:
You can see the comment here.