Page 1 of 2

Subdomain Working but with two error

Posted: Wed Jun 10, 2020 2:19 pm
by netlantv
Hello,
I see many people speak about to access with a subdomain.

I made a working solution :
- Register a new domain : panel.domain.com
- Modify the config file to have :

Code: Select all

location / {
        proxy_pass      https://XX.XX.XX.XX:8083;
    }
all is working but when a create or deleted a domain have an error :
- Created : Error: Web domain xxxxxxxxx.com exist
The domaine is well create but it return the error.
Image

- Deleted : ERR_CONNECTION_CLOSED
Image

I used MyVesta fork by dpeca
Config :
- Debian 10
- Ryzen 7 3800
- 4Gb Ram


Thanks for you help

Re: Subdomain Working but with two error

Posted: Wed Jun 10, 2020 5:24 pm
by dpeca
You are doing something wrong since you are modifying nginx conf, which you never should do, because soon or later it will overwriten with template.

Please describe what you are trying to do.

Subdomain will works if you add it the same way you are adding main domain.

Re: Subdomain Working but with two error

Posted: Wed Jun 10, 2020 7:16 pm
by netlantv
Yes, I understand,

I modified the file in /home/admin/conf/web

panel.domain.com.nginx.ssl.conf

Original:

Code: Select all

location/ {
        proxy_pass https://XX.XX.XX.XX:8443;
        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|ttf|otf|webp|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|t$
            root /home/admin/web/valentindoche.com/public_html;
            access_log /var/log/apache2/domains/domain.com.log combined;
            access_log /var/log/apache2/domains/domain.com.bytes bytes;
            expires max;
            # try_files $uri @fallback;
        }
    }

Modified:

Code: Select all

location / {
        proxy_pass https://XX.XX.XX.XX:8083;
    }
The goal is to be able to access the panel when I do panel.domain.com.

Re: Subdomain Working but with two error

Posted: Thu Jun 11, 2020 8:20 pm
by dpeca
create /usr/local/vesta/data/templates/web/nginx/vesta.stpl

Code: Select all

server {
    listen      %ip%:%proxy_ssl_port% http2;
    server_name %domain_idn% %alias_idn%;
    # ssl         on;
    ssl_certificate      %ssl_pem%;
    ssl_certificate_key  %ssl_key%;
    error_log  /var/log/%web_system%/domains/%domain%.error.log error;
    access_log     /var/log/%web_system%/domains/%domain%.log combined;

    location / {
        proxy_pass      https://%ip%:8083;
    }

    location /webmail {
        disable_symlinks off;
        proxy_pass      https://%ip%:%web_ssl_port%;
        location ~* ^.+\.(%proxy_extentions%)$ {
            root           /var/lib/roundcube;
            access_log     /var/log/%web_system%/domains/%domain%.log combined;
            access_log     /var/log/%web_system%/domains/%domain%.bytes bytes;
            expires        max;
            # try_files      $uri @fallback;
        }
    }

    location /phpmyadmin {
        disable_symlinks off;
        proxy_pass      https://%ip%:%web_ssl_port%;
        location ~* ^.+\.(%proxy_extentions%)$ {
            root           /usr/share;
            access_log     /var/log/%web_system%/domains/%domain%.log combined;
            access_log     /var/log/%web_system%/domains/%domain%.bytes bytes;
            expires        max;
            # try_files      $uri @fallback;
        }
    }

    location /phpmyadmin/ {
        proxy_pass      https://%ip%:%web_ssl_port%;
    }

    location ~ /\.ht    {return 404;}
    location ~ /\.svn/  {return 404;}
    location ~ /\.git/  {return 404;}
    location ~ /\.hg/   {return 404;}
    location ~ /\.bzr/  {return 404;}

    disable_symlinks if_not_owner from=%docroot%;

    include %home%/%user%/conf/web/snginx.%domain_idn%.conf*;
}

create /usr/local/vesta/data/templates/web/nginx/vesta.tpl

Code: Select all

server {
    listen      %ip%:%proxy_port%;
    server_name %domain_idn% %alias_idn%;
    location / {
        rewrite ^(.*) https://%domain_idn%$1 permanent;
    }
include %home%/%user%/conf/web/*nginx.%domain_idn%.conf_letsencrypt;
}
then assign vesta nginx template to your panel subdomain.

Re: Subdomain Working but with two error

Posted: Fri Jun 12, 2020 12:44 pm
by netlantv
Hello,

I have always the same error :
  • When i create a domainWhen i create a domain :
    The panel say : Error: Web Domain domain.com exist
    In error log i have nothing and i access log i have :

    Code: Select all

    XX.XX.XX.XX - - [12/Jun/2020:14:31:11 +0200] "POST /add/web/ HTTP/2.0" 200 4013 "https://panel.domain.dev/add/web/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36"
    XX.XX.XX.XX - - [12/Jun/2020:14:31:11 +0200] "GET /js/i18n.js.php?1491697868 HTTP/2.0" 200 977 "https://panel.domain.dev/add/web/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36"

Re: Subdomain Working but with two error

Posted: Fri Jun 12, 2020 12:54 pm
by dpeca
maybe you really have that domain already added?

Re: Subdomain Working but with two error

Posted: Fri Jun 12, 2020 12:56 pm
by netlantv
I roll my head on the keyboard :
jhdfcgsdjdfhsgdfhjksdg
dshjdsdhsd

Re: Subdomain Working but with two error

Posted: Fri Jun 12, 2020 1:20 pm
by dpeca
or maybe modifications that you made in nginx conf files makes some conflict?
try to rebuild configs:

Code: Select all

for user in $(grep '@' /etc/passwd |cut -f1 -d:); do
    if [ ! -f "/usr/local/vesta/data/users/$user/user.conf" ]; then
        continue;
    fi
    v-rebuild-web-domains $user 'no'
done
service nginx restart
service apache2 restart

Re: Subdomain Working but with two error

Posted: Fri Jun 12, 2020 1:30 pm
by dpeca
or maybe panel.domain.com is added as alias?

Re: Subdomain Working but with two error

Posted: Fri Jun 12, 2020 1:42 pm
by netlantv

Code: Select all

-bash: v-rebuild-web-domains: command not found