NGINX HTTPS

5 posts / 0 new
Last post
#1 Fri, 2018-03-16 01:56
LA
  • LA's picture
  • Offline
  • Last seen: 1 week 5 days ago
  • Joined: 2018-03-16

Hi,

Any idea how to make HTTPS work once HTTPS is working and CA are in place ?

Rgrds

Mon, 2018-03-19 11:55
zacksiri
  • zacksiri's picture
  • Offline
  • Last seen: 1 week 5 days ago
  • Joined: 2017-10-06

how did you setup your nginx config?

Mon, 2018-03-19 12:11 (Reply to #2)
LA
  • LA's picture
  • Offline
  • Last seen: 1 week 5 days ago
  • Joined: 2018-03-16

thanks for reply. this is my config.

user www;
worker_processes auto; # it will be determinate automatically by the number of core

error_log /var/log/nginx/error.log warn;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
access_log /var/log/nginx/access.log;
keepalive_timeout 3000;
server {
listen 80;
listen 443 ssl;
root /www/example.com;
index index.html index.htm;
server_name www.example.com example.com;
client_max_body_size 32m;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/lib/nginx/html;
}
}
}

Mon, 2018-03-19 12:44
zacksiri
  • zacksiri's picture
  • Offline
  • Last seen: 1 week 5 days ago
  • Joined: 2017-10-06

You haven't pointed your config to the ssl certs yet,

i suggest you read through here, even though you are not using ubuntu, try looking at the nginx config.

https://www.digitalocean.com/community/tutorials/how-to-create-an-ssl-certificate-on-nginx-for-ubuntu-14-04

Also I suggest you learn to use the code tag like below.

 http {
 
}

Mon, 2018-03-19 12:53
LA
  • LA's picture
  • Offline
  • Last seen: 1 week 5 days ago
  • Joined: 2018-03-16

thanks. I have ssl under /etc/nginx/conf.d/example.com.conf. HTTP is working correctly.

server {
listen 80 default_server;
listen [::]:80 default_server;
# Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
return 301 https://$host$request_uri;
}

server {
listen 443 ssl http2;
listen [::]:443 ssl http2;

ssl on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /etc/ssl/certs/CloudFlare/example.com.pem;
ssl_certificate_key /etc/ssl/certs/CloudFlare/example.com.key;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;

server_name www.example.com example.com;
access_log /var/log/nginx/nginx.vhost.access.log;
error_log /var/log/nginx/nginx.vhost.error.log;
location / {
root /www/example.com/;
index index.html;

resolver 8.8.8.8 8.8.4.4;
}
}

Log in or register to post comments