## # Put this file in /etc/nginx/conf.d folder and make sure # you have line 'include /etc/nginx/conf.d/*.conf;' # in your main nginx configuration file ## ## # Redirect to the same URL with https:// ## server { listen 80; # Type your domain name below server_name example.com; return 301 https://$server_name$request_uri; } ## # HTTPS configurations ## server { listen 443; # Type your domain name below server_name example.com; ssl on; ssl_certificate /path/to/certificate.crt; ssl_certificate_key /path/to/server.key; # Use only TSL protocols for more secure ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Always serve index.html for any request location / { # Set path root /var/www/; try_files $uri /index.html; } ## # If you want to use Node/Rails/etc. API server # on the same port (443) config Nginx as a reverse proxy. # For security reasons use a firewall like ufw in Ubuntu # and deny port 3000/tcp. ## # location /api/ { # # proxy_pass http://localhost:3000; # proxy_http_version 1.1; # proxy_set_header X-Forwarded-Proto https; # proxy_set_header Upgrade $http_upgrade; # proxy_set_header Connection 'upgrade'; # proxy_set_header Host $host; # proxy_cache_bypass $http_upgrade; # # } }