# The Eenos Hosting Control 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
# Auto built on ${TIME}
#------------------------------------------------------------
#       Reserved ports for eenos web services
#       .....................................
#
# WAP  non-ssl : 5554
# WAP  ssl     : 5555
# RAPP  non-ssl : 4443
# RAPP  ssl     : 4444
# UAPP non-ssl : 3332
# UAPP ssl     : 3333
#............................................................
# /eenos-phpmyadmin  - The phpmyadmin 
# The wap ( Webhost Admin Panel) - Start
server {
    listen 5554 default_server;
    listen [::]:5554 default_server;
    %if  haveipv4 =="on":
    listen ${ipv4}:5554 ;
    %endif
    %if  haveipv6 =="on":    
    listen [${ipv6}]:5554 ;
    %endif
    server_name ${server_name} _;
    access_log /var/log/eenos/eenosd.access.log;
    location = /favicon.ico { access_log off; log_not_found off; }
    %if HAVESSL == '1' and forcessl == "on":
    location / {        
        rewrite ^/(.*) https://$host:5555$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/wap[.]*.conf;
    # APPS
    location /static/ {
        root /usr/local/eenos/wap/public/;
    }
    location / { 
        include /usr/local/eenos/etc/eenosd/uwsgi_params;
        uwsgi_pass unix:/usr/local/eenos/tmp/wap.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 == '1':
server {
    listen 5555 default_server ssl;
    listen [::]:5555 default_server ssl;
    listen 5555 quic reuseport;
    listen [::]:5555 quic reuseport;
    http2 on;
    http3 on;
    http3_hq on;
    add_header Alt-Svc 'h3=":$server_port"; ma=86400';
    %if  haveipv4 =="on":
    listen ${ipv4}:5555 ssl;
    listen ${ipv4}:5555 quic;
    %endif
    %if  haveipv6 =="on":    
    listen [${ipv6}]:5555 ssl;
    listen [${ipv6}]:5555 quic;
    %endif    
    server_name ${server_name} _;
    access_log /var/log/eenos/eenosd.access.log;
    ssl_certificate ${CRT};
    ssl_certificate_key ${KEY};
    % if HAVEDHPARAM == '1':
    ssl_dhparam /usr/local/eenos/etc/ssl/dhparams.pem;
    % endif
    ssl_protocols TLSv1.3 TLSv1.2;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout  5m;
    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;
    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/wap[.]*.conf;
    # APPS
    location /static/ {
        root /usr/local/eenos/wap/public/;
    }
    location / {        
        include /usr/local/eenos/etc/eenosd/uwsgi_params;
        uwsgi_pass unix:/usr/local/eenos/tmp/wap.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 wap ( Webhost Admin Panel) -  End 

# The RAPP ( Reseller control panel ) - Start
server {
    listen 4443 default_server;
    listen [::]:4443 default_server;
    %if  haveipv4 =="on":
    listen ${ipv4}:4443;
    %endif
    %if  haveipv6 =="on":    
    listen [${ipv6}]:4443;
    %endif
    %if cp_ports :
    listen 2086 default_server;
    listen [::]:2086 default_server;
    %endif
    server_name ${server_name} _;
    access_log /var/log/eenos/eenosd.access.log;
    location = /favicon.ico { access_log off; log_not_found off; }
    %if HAVESSL == '1' and forcessl == "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 == '1':
server {
    listen 4444 default_server ssl;
    listen [::]:4444 default_server ssl;
    listen 4444 quic reuseport;
    listen [::]:4444 quic reuseport;
    http2 on;
    http3 on;
    http3_hq on;
    add_header Alt-Svc 'h3=":$server_port"; ma=86400';
    %if  haveipv4 =="on":
    listen ${ipv4}:4444 ssl;
    listen ${ipv4}:4444 quic;
    %endif
    %if  haveipv6 =="on":    
    listen [${ipv6}]:4444 ssl;
    listen [${ipv6}]:4444 quic;
    %endif
    %if cp_ports :
    listen 2087 default_server ssl;
    listen [::]:2087 default_server ssl;
    listen 2087 quic reuseport;
    listen [::]:2087 quic reuseport;
    %endif
    server_name ${server_name} _;
    access_log /var/log/eenos/eenosd.access.log;
    ssl_certificate ${CRT};
    ssl_certificate_key ${KEY};
    % if HAVEDHPARAM == '1':
    ssl_dhparam /usr/local/eenos/etc/ssl/dhparams.pem;
    % endif
    ssl_protocols TLSv1.3 TLSv1.2;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout  5m;
    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;
    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


# The Uapp ( User control panel ) - Start
server {
    listen 3332 default_server;
    listen [::]:3332 default_server;
    %if  haveipv4 =="on":
    listen ${ipv4}:3332;
    %endif
    %if  haveipv6 =="on":    
    listen [${ipv6}]:3332;
    %endif
    %if cp_ports :
    listen 2082 default_server;
    listen [::]:2082 default_server;
    %endif
    %if da_ports and HAVESSL == '0':
    listen 2222 default_server;
    listen [::]:2222 default_server;
    %endif
    %if pk_ports:
    listen 8880 default_server;
    listen [::]:8880 default_server;
    %endif
    server_name ${server_name} _;
    access_log /var/log/eenos/eenosd.access.log;
    location = /favicon.ico { access_log off; log_not_found off; }
    %if HAVESSL == '1' and forcessl == "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 == '1':
server {
    listen 3333 default_server ssl;
    listen [::]:3333 default_server ssl;
    listen 3333 quic reuseport;
    listen [::]:3333 quic reuseport;
    http2 on;
    http3 on;
    http3_hq on;
    add_header Alt-Svc 'h3=":$server_port"; ma=86400';
    %if  haveipv4 =="on":
    listen ${ipv4}:3333 ssl;
    listen ${ipv4}:3333 quic;
    %endif
    %if  haveipv6 =="on":    
    listen [${ipv6}]:3333 ssl;
    listen [${ipv6}]:3333 quic;
    %endif
    %if cp_ports :
    listen 2083 default_server ssl;
    listen [::]:2083 default_server ssl;
    listen 2083 quic reuseport;
    listen [::]:2083 quic reuseport;
    %endif
    %if da_ports:
    listen 2222 default_server ssl;
    listen [::]:2222 default_server ssl;
    listen 2222 quic reuseport;
    listen [::]:2222 quic reuseport;
    %endif
    %if pk_ports:
    listen 8443 default_server ssl;
    listen [::]:8443 default_server ssl;
    listen 8443 quic reuseport;
    listen [::]:8443 quic reuseport;
    %endif
    server_name ${server_name} _;
    access_log /var/log/eenos/eenosd.access.log;
    ssl_certificate ${CRT};
    ssl_certificate_key ${KEY};
    % if HAVEDHPARAM == '1':
    ssl_dhparam /usr/local/eenos/etc/ssl/dhparams.pem;
    % endif
    ssl_protocols TLSv1.3 TLSv1.2;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout  5m;
    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;
    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
# The  End user  Eenos Per domain Vhosts
include /var/eenos/userdata/*/vhosts/eenosd/*[.]conf;
#