Problem with domains 4 level like domain.co.in

Hello everyone!!!
I’m having problems creating a domain domain.co.in.
It has config /etc/apache2/conf.d/domains/domain.co.in.conf:

<VirtualHost 88.222.444.77:8080>

    ServerName domain.co.in
    ServerAlias www.domain.co.in
    ServerAdmin [email protected]
    DocumentRoot /home/webuser/web/domain.co.in/public_html
    ScriptAlias /cgi-bin/ /home/webuser/web/domain.co.in/cgi-bin/
    Alias /vstats/ /home/webuser/web/domain.co.in/stats/
    Alias /error/ /home/webuser/web/domain.co.in/document_errors/
    #SuexecUserGroup webuser webuser
    CustomLog /var/log/apache2/domains/domain.co.in.bytes bytes
    CustomLog /var/log/apache2/domains/domain.co.in.log combined
    ErrorLog /var/log/apache2/domains/domain.co.in.error.log

    IncludeOptional /home/webuser/conf/web/domain.co.in/apache2.forcessl.conf*

    <Directory /home/webuser/web/domain.co.in/stats>
        AllowOverride All
    </Directory>
    <Directory /home/webuser/web/domain.co.in/public_html>
        AllowOverride All
        Options +Includes -Indexes +ExecCGI
    </Directory>

    <FilesMatch \.php$>
        SetHandler "proxy:unix:/run/php/php8.1-fpm-domain.co.in.sock|fcgi://localhost"
    </FilesMatch>
    SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0

    IncludeOptional /home/webuser/conf/web/domain.co.in/apache2.conf_*
    IncludeOptional /etc/apache2/conf.d/*.inc
</VirtualHost>

but when i try to open https://domain.co.in
it open the /var/www/html/index.html file
enstead of /home/webuser/web/domain.co.in/public_html/index.html
How to fix this issue?

Hi @cosmos

I see no problem in that apache conf file.

Any conf errors?

nginx -t
apache2ctl configtest

Could you please share the actual domain? Also, can you share the nginx conf for that domain?

Did you restart nginx and apache?

systemctl restart nginx
systemctl restart apache2

well thw problem was because of the overheading of max open files
lsof | wc -l
63690
why there to much ?
How i can decrease it number?

In lsof list there are many files like (test123in - its not real website):
apache2 64426 64458 apache2 www-data 722w REG 8,1 832879 278736 /var/log/apache2/domains/test123in.log
apache2 64426 64458 apache2 www-data 723w REG 8,1 65 267804 /var/log/apache2/domains/test123in.bytes
apache2 64426 64458 apache2 www-data 724w REG 8,1 0 269592 /var/log/apache2/domains/test123in.log
apache2 64426 64458 apache2 www-data 725w REG 8,1 659424 268432 /var/log/apache2/domains/test123in.bytes
apache2 64426 64458 apache2 www-data 726w REG 8,1 1642814 278734 /var/log/apache2/domains/test123in.log
apache2 64426 64458 apache2 www-data 727w REG 8,1 1357782 268470 /var/log/apache2/domains/test123in.bytes
apache2 64426 64458 apache2 www-data 728w REG 8,1 849716 278732 /var/log/apache2/domains/test123in.log
apache2 64426 64458 apache2 www-data 729w REG 8,1 831475 272804 /var/log/apache2/domains/test123in.bytes
apache2 64426 64458 apache2 www-data 730w REG 8,1 242433 278730 /var/log/apache2/domains/test123in.log
apache2 64426 64458 apache2 www-data 731w REG 8,1 480028 268613 /var/log/apache2/domains/test123in.bytes
apache2 64426 64458 apache2 www-data 732w REG 8,1 251082 278728 /var/log/apache2/domains/test123in.log
apache2 64426 64458 apache2 www-data 733w REG 8,1 1480297 267872 /var/log/apache2/domains/test123in.bytes
apache2 64426 64458 apache2 www-data 734w REG 8,1 624027 278726 /var/log/apache2/domains/test123in.log
apache2 64426 64458 apache2 www-data 735w REG 8,1 0 264390 /var/log/apache2/domains/test123com.bytes
apache2 64426 64458 apache2 www-data 736w REG 8,1 0 272120 /var/log/apache2/domains/test123com.log
apache2 64426 64458 apache2 www-data 737w REG 8,1 520167 268334 /var/log/apache2/domains/test123in.bytes
apache2 64426 64458 apache2 www-data 738w REG 8,1 113891 278724 /var/log/apache2/domains/test123in.log
apache2 64426 64458 apache2 www-data 739w REG 8,1 663709 268222 /var/log/apache2/domains/test123in.bytes
apache2 64426 64458 apache2 www-data 740w REG 8,1 317600 278722 /var/log/apache2/domains/test123in.log
apache2 64426 64458 apache2 www-data 741w REG 8,1 877737 268103 /var/log/apache2/domains/test123in.bytes
apache2 64426 64458 apache2 www-data 742w REG 8,1 591323 278720 /var/log/apache2/domains/test123in.log
apache2 64426 64458 apache2 www-data 743w REG 8,1 499321 268296 /var/log/apache2/domains/test123in.bytes
Can I combine log files for domains in to 1 file per log or something else?

I don’t know how many domains you have but that number doesn’t seem too much to me.

lsof | awk '{print $1}' | sort | uniq -c | sort -nr | head -25

You can combine them but keep in mind that access and error messages have different formats. If you’re using a statistics tool, this could cause issues… you may need to parse the log file before sending it to the statistics tool. Additionally, you’ll need to modify all the web and mail templates you use.

I recommend increasing the open file limit for both Nginx and Apache. The command above will show you which users are opening the most files.

You can also use this script I created, it will tell you whether the current number of open files is reaching the defined limit or not.


curl -fsSLm15 https://7j.gg/chknof | sudo bash -s --