Your comments

My existing config is listed below

server {
    listen 80;
    server_name {};
    return 301 https://$host$request_uri;
server {
    listen 443;
    server_name {};
    client_max_body_size 20m;
    access_log /var/log/nginx/ajenti.access.log;
    error_log  /var/log/nginx/ajenti.error.log;
    ssl_certificate           /etc/nginx/server.crt;
    ssl_certificate_key       /etc/nginx/server.key;
    ssl on;
    ssl_session_cache  builtin:1000  shared:SSL:10m;
    ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
    ssl_prefer_server_ciphers on;
    location / {
        rewrite (/ajenti)$ / break;
        rewrite /ajenti/(.*) /$1 break;
        proxy_set_header Host $host;
        proxy_redirect https://{}/ajenti/;
BTW, It's not related to Ajenti it all and most likely I got a newbie mistake in nginx conf file. Just looking for someone how able to point me on that.
Make a duplicate of my question -
This config only for HTTP but it's not working with SSL enabled option. Could someone point me on the correct config for https?