Nginx config for Ajenti with SSL enabled option

Constantine Mureev 6 years ago updated 6 years ago 2
Hi evryone,

Existing public nginx conf is not supporting https. I try to make my own and use couple of samples (1 and 2) but I fail.

So can someone of nginx masters point me on correct nginx conf for Ajenti with SSL enabled option?
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.
My existing config is listed below

server {
    listen 80;
    server_name {cp.domain.com};
    return 301 https://$host$request_uri;
server {
    listen 443;
    server_name {cp.domain.com};
    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://{cp.domain.com}/ajenti/;