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;
how did you setup your nginx config?
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;
}
}
}
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.
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;
}
}