server { listen 81; listen [::]:81; server_name fs-auth-server.dev.ceit.pdn.ac.lk ; root /home/ceit_fs_auth_server/public_web; index index.html; access_log /var/log/nginx/fs-auth-server.dev.ceit.pdn.ac.lk_access.log; error_log /var/log/nginx/fs-auth-server.dev.ceit.pdn.ac.lk_error.log; location / { try_files $uri $uri/ =404; } location /.well-known/ { alias /home/ceit_fs_auth_server/well-known/; } location /.well-known/acme-challenge { alias /var/lib/letsencrypt/.well-known/acme-challenge/; } # Block access to "hidden" files and directories whose names begin with a # period. This includes directories used by version control systems such # as Subversion or Git to store control files. location ~ (^|/)\.(?!well-known).* { return 403; } } server { listen 443 ssl; listen [::]:443 ssl; server_name fs-auth-server.dev.ceit.pdn.ac.lk ; location / { proxy_pass http://127.0.0.1:8051; 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 X-Forwarded-Port 443; proxy_set_header Host $host; } # # To create a self signed certificate, run the below command # # openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/fs-auth-server.dev.ceit.pdn.ac.lk/server.key -out /etc/nginx/ssl/fs-auth-server.dev.ceit.pdn.ac.lk/server.crt # # Or non-intractively # # openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=AB/ST=ABC/L=ABCD/O=ABCDE/CN=fs-auth-server.dev.ceit.pdn.ac.lk" -keyout /etc/nginx/ssl/fs-auth-server.dev.ceit.pdn.ac.lk/server.key -out /etc/nginx/ssl/fs-auth-server.dev.ceit.pdn.ac.lk/server.crt ssl_certificate /etc/letsencrypt/live/fs-auth-server.dev.ceit.pdn.ac.lk/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/fs-auth-server.dev.ceit.pdn.ac.lk/privkey.pem; # managed by Certbot ssl_dhparam /etc/nginx/ssl/dhparams.pem; }