hi aminbaik ,
you can use the following example and fill the values in <>
server {
listen 80;
server_name example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name example.com;
error_log /var/log/nginx/example.com.error.log warn;
access_log /var/log/nginx/example.com.access.log warn;
ssl on;
ssl_certificate /etc/nginx/ssl/<yourkeys>.crt;
ssl_certificate_key /etc/nginx/ssl/<yourkeys>.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://<actualwebserverip>;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache_key backend$request_uri;
proxy_cache_valid 200 301 302 20m;
proxy_cache_valid 404 1m;
proxy_cache_valid any 15m;
proxy_cache_use_stale error timeout invalid_header updating;
}
}
hope this helps ! best of luck
you can use the following example and fill the values in <>
server {
listen 80;
server_name example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name example.com;
error_log /var/log/nginx/example.com.error.log warn;
access_log /var/log/nginx/example.com.access.log warn;
ssl on;
ssl_certificate /etc/nginx/ssl/<yourkeys>.crt;
ssl_certificate_key /etc/nginx/ssl/<yourkeys>.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://<actualwebserverip>;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache_key backend$request_uri;
proxy_cache_valid 200 301 302 20m;
proxy_cache_valid 404 1m;
proxy_cache_valid any 15m;
proxy_cache_use_stale error timeout invalid_header updating;
}
}
hope this helps ! best of luck