# The Eenos Hosting Control Panel User Panel Vhost
# This is a auto generated  vhost file. All custom modification 
# on this file will be rewritten
# You may use the custom template file to modify the settings
#............................................................................
# Build Time - ${time}
# Domain name - ${servername}
#............................................................................
%if  isreseller == "on":
# The ( Reseller control panel ) - Start
server {
    %if isipv4 == "on":
    listen ${ips['ipv4']}:4443;
        %if cp_ports :
    listen ${ips['ipv4']}:2086;
        %endif
    %endif
    %if isipv6 == "on":
    listen  [${ips['ipv6']}]:4443;
        %if cp_ports :
    listen  [${ips['ipv6']}]:2086;
        %endif
    %endif  
    server_name ${servername} ${serveralias} eenos.${servername};   
    access_log /var/log/eenos/eenosd.access.log;
    location = /favicon.ico { access_log off; log_not_found off; }
    %if redirect['http-to-https'] == "on" and havessl=="on":     
    location / {        
        rewrite ^/(.*) https://$host:4444$request_uri permanent;
    }
    %else:
    # PHPMyadmin   
    include /usr/local/eenos/etc/eenosd/phpmyadmin[.]conf;
    # PHPMyadmin 
    # phpPgAdmin 
    include /usr/local/eenos/etc/eenosd/phppgadmin[.]conf;
    # phpPgAdmin 
    # Roundcube 
    include /usr/local/eenos/etc/eenosd/roundcube[.]conf;
    # Roundcube
    # APPS
    include /usr/local/eenos/etc/eenosd/rapp[.]*.conf;
    # APPS
    location /static/ {
        root /usr/local/eenos/rapp/public/;
    }
    location / { 
        include /usr/local/eenos/etc/eenosd/uwsgi_params;
        uwsgi_pass unix:/usr/local/eenos/tmp/rapp.sock;
        uwsgi_param Host $host;
        uwsgi_param X-Real-IP $remote_addr;
        uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
        uwsgi_param X-Forwarded-Proto $http_x_forwarded_proto;
        
    }
    %endif
}

%if havessl=="on":
server {
    %if isipv4 == "on":
    listen ${ips['ipv4']}:4444 ssl;
    listen ${ips['ipv4']}:4444 quic;
        %if cp_ports :
    listen ${ips['ipv4']}:2087 ssl;
    listen ${ips['ipv4']}:2087 quic;
        %endif
    %endif
    %if isipv6 == "on":
    listen  [${ips['ipv6']}]:4444 ssl;
    listen  [${ips['ipv6']}]:4444 quic;
        %if cp_ports :
    listen  [${ips['ipv6']}]:2087 ssl;
    listen  [${ips['ipv6']}]:2087 quic;
        %endif
    %endif  
    http2 on;
    http3 on;
    http3_hq on;
    add_header Alt-Svc 'h3=":$server_port"; ma=86400';
    server_name ${servername} ${serveralias} eenos.${servername};       
    access_log /var/log/eenos/eenosd.access.log;       
    ssl_certificate ${sslcrt};
    ssl_certificate_key ${sslkey};
    ssl_dhparam /usr/local/eenos/etc/ssl/dhparams.pem;
    ssl_protocols TLSv1.3 TLSv1.2;
    ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA512:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:ECDH+AESGCM:ECDH+AES256:DH+AESGCM:DH+AES256:RSA+AESGCM:!aNULL:!eNULL:!LOW:!RC4:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS;    
    ssl_session_cache   shared:SSL:10m;
    ssl_session_timeout 60m;    
    location = /favicon.ico { access_log off; log_not_found off; }
    error_page 400 https://$host:$server_port$request_uri;
    # PHPMyadmin   
    include /usr/local/eenos/etc/eenosd/phpmyadmin[.]conf;
    # PHPMyadmin
    # phpPgAdmin 
    include /usr/local/eenos/etc/eenosd/phppgadmin[.]conf;
    # phpPgAdmin  
    # Roundcube 
    include /usr/local/eenos/etc/eenosd/roundcube[.]conf;
    # Roundcube
    # APPS
    include /usr/local/eenos/etc/eenosd/rapp[.]*.conf;
    # APPS
    location /static/ {
        root /usr/local/eenos/rapp/public/;
    }
    location / {        
        include /usr/local/eenos/etc/eenosd/uwsgi_params;
        uwsgi_pass unix:/usr/local/eenos/tmp/rapp.sock;
        uwsgi_param Host $host;
        uwsgi_param X-Real-IP $remote_addr;
        uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
        uwsgi_param X-Forwarded-Proto $http_x_forwarded_proto;
    }
}
% endif
# The RAPP ( Reseller control panel ) - END
%endif
# The User control panel  - Start
server {
    %if isipv4 == "on":
    listen ${ips['ipv4']}:3332;
        %if cp_ports :
    listen ${ips['ipv4']}:2082;
        %endif  
        %if pk_ports:
    listen ${ips['ipv4']}:8880;  
        %endif  
    %endif
    %if isipv6 == "on":
    listen  [${ips['ipv6']}]:3332;
        %if cp_ports :
    listen  [${ips['ipv6']}]:2082;
        %endif
        %if pk_ports:
    listen ${ips['ipv6']}:8880;  
        %endif  
    %endif  
    server_name ${servername} ${serveralias} eenos.${servername};  
    access_log /var/log/eenos/eenosd.access.log;
    location = /favicon.ico { access_log off; log_not_found off; }    
    %if redirect['http-to-https'] == "on" and havessl=="on":  
    location / {        
        rewrite ^/(.*) https://$host:3333$request_uri permanent;
    }
    %else:
    # PHPMyadmin   
    include /usr/local/eenos/etc/eenosd/phpmyadmin[.]conf;
    # PHPMyadmin 
    # phpPgAdmin 
    include /usr/local/eenos/etc/eenosd/phppgadmin[.]conf;
    # phpPgAdmin 
    # Roundcube 
    include /usr/local/eenos/etc/eenosd/roundcube[.]conf;
    # Roundcube
    # File manager
    include /usr/local/eenos/etc/eenosd/filemanager[.]conf;
    # File manager
    # APPS
    include /usr/local/eenos/etc/eenosd/uapp[.]*.conf;
    # APPS
    location /static/ {
        root /usr/local/eenos/uapp/public/;
    }
    location / { 
        include /usr/local/eenos/etc/eenosd/uwsgi_params;
        uwsgi_pass unix:/usr/local/eenos/tmp/uapp.sock;
        uwsgi_param Host $host;
        uwsgi_param X-Real-IP $remote_addr;
        uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
        uwsgi_param X-Forwarded-Proto $http_x_forwarded_proto;
        
    }
    %endif
}

%if havessl=="on":
server {
     %if isipv4 == "on":
    listen ${ips['ipv4']}:3333 ssl;
    listen ${ips['ipv4']}:3333 quic;
        %if cp_ports :
    listen ${ips['ipv4']}:2083 ssl;
    listen ${ips['ipv4']}:2083 quic;
        %endif
        %if da_ports:
    listen ${ips['ipv4']}:2222 ssl;
    listen ${ips['ipv4']}:2222 quic;
        %endif
        %if pk_ports:
    listen ${ips['ipv4']}:8443 ssl;  
    listen ${ips['ipv4']}:8443 quic;  
        %endif  
    %endif
    %if isipv6 == "on":
    listen  [${ips['ipv6']}]:3333 ssl;
    listen  [${ips['ipv6']}]:3333 quic;
        %if cp_ports :
    listen  [${ips['ipv6']}]:2083 ssl;
    listen  [${ips['ipv6']}]:2083 quic;
        %endif
        %if da_ports:
    listen ${ips['ipv6']}:2222 ssl;
    listen ${ips['ipv6']}:2222 quic;
        %endif
        %if pk_ports:
    listen ${ips['ipv6']}:8443 ssl;  
    listen ${ips['ipv6']}:8443 quic;  
        %endif  
    %endif  
    http2 on;
    http3 on;
    http3_hq on;
    add_header Alt-Svc 'h3=":$server_port"; ma=86400';
    server_name ${servername} ${serveralias} eenos.${servername};     
    access_log /var/log/eenos/eenosd.access.log;
    ssl_certificate ${sslcrt};
    ssl_certificate_key ${sslkey};
    ssl_dhparam /usr/local/eenos/etc/ssl/dhparams.pem;
    ssl_protocols TLSv1.3 TLSv1.2;
    ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA512:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:ECDH+AESGCM:ECDH+AES256:DH+AESGCM:DH+AES256:RSA+AESGCM:!aNULL:!eNULL:!LOW:!RC4:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS;    
    ssl_session_cache   shared:SSL:10m;
    ssl_session_timeout 60m;        
    location = /favicon.ico { access_log off; log_not_found off; }
    error_page 400 https://$host:$server_port$request_uri;
    # PHPMyadmin   
    include /usr/local/eenos/etc/eenosd/phpmyadmin[.]conf;
    # PHPMyadmin
    # phpPgAdmin 
    include /usr/local/eenos/etc/eenosd/phppgadmin[.]conf;
    # phpPgAdmin  
    # Roundcube 
    include /usr/local/eenos/etc/eenosd/roundcube[.]conf;
    # Roundcube
    # File manager
    include /usr/local/eenos/etc/eenosd/filemanager[.]conf;
    # File manager
    # APPS
    include /usr/local/eenos/etc/eenosd/uapp[.]*.conf;
    # APPS
    location /static/ {
        root /usr/local/eenos/uapp/public/;
    }
    location / {        
        include /usr/local/eenos/etc/eenosd/uwsgi_params;
        uwsgi_pass unix:/usr/local/eenos/tmp/uapp.sock;
        uwsgi_param Host $host;
        uwsgi_param X-Real-IP $remote_addr;
        uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
        uwsgi_param X-Forwarded-Proto $http_x_forwarded_proto;
    }
}
% endif
# The Uapp ( User control panel ) - END