Custom http.conf for subdomains

storm_shadow

Verified User
Joined
Oct 8, 2016
Messages
27
hi
I tried all the ways I knew, But...
Let me explain with an example what I want.
I have a blog service, with main domain and many domain pointers and subdomains.
Main domain: blog.com
Subdomains: sub1.blog.com, sub2.blog.com, sub3.blog.com and....
Domain pointers : domain1.com , domain2.com, domain3.com and...
Every domain redirect to a spacial subdomain with Php code

But, what is the problem?

When i add a Subdomain (for exapmle sub2.blog.com) to Sub Domains, in user httpd.conf create VirtualHost settings for All domain pointers (sub2.domain1.com, sub2.domain2.com, sub2.domain3.com and...) ... But i don't want it!!!

And what is the big problem ???
for example if i had 600 domain pointer, with create 500 subdomains, httpd add 3000000 (500x600) VirtualHost settings to user httpd.conf file. and httpd.conf file size will be very large.
What will be the result?
* A big time needed to create httpd.conf file
* Server load coming to very High
* Apache server Crash
And...

I want Subdomain VirtualHost just create for Main Domain (sub2.blog.com) , not for Domain Pointers... I don't need sub2.domain1.com or others...

What can i do for this ? Help me Guys

Can I change rewrite_confs script to do what i want it?
Or any way....???

Here the VirtualHost settings that happened to me:(
Apache config:
<VirtualHost 88.88.88.88:80 >
    ServerName www.sub1.domain1.com
    ServerAlias www.sub1.domain1.com sub1.domain1.com
    ServerAdmin [email protected]
    DocumentRoot /home/blog/domains/blog.com/public_html/sub1
    UseCanonicalName OFF
    <IfModule !mod_ruid2.c>
        SuexecUserGroup blog blog
    </IfModule>
    CustomLog /var/log/httpd/domains/blog.com.sub1.bytes bytes
    CustomLog /var/log/httpd/domains/blog.com.sub1.log combined
    ErrorLog /var/log/httpd/domains/blog.com.sub1.error.log
    <Directory /home/blog/domains/blog.com/public_html/sub1>
        AllowOverride AuthConfig FileInfo Indexes Limit Options=Indexes,IncludesNOEXEC,MultiViews,SymLinksIfOwnerMatch,FollowSymLinks,None
        Options -ExecCGI -Includes +IncludesNOEXEC
        <FilesMatch "\.(inc|php|phtml|phps|php56)$">
            <If "-f %{REQUEST_FILENAME}">
                #ProxyErrorOverride on
                AddHandler "proxy:unix:/usr/local/php56/sockets/blog.sock|fcgi://localhost" .inc .php .phtml .php56
            </If>
        </FilesMatch>
    </Directory>
</VirtualHost>

<VirtualHost 88.88.88.88:80 >
    ServerName www.sub1.domain2.com
    ServerAlias www.sub1.domain2.com news.domain2.com
    ServerAdmin [email protected]
    DocumentRoot /home/blog/domains/blog.com/public_html/sub1
    UseCanonicalName OFF
    <IfModule !mod_ruid2.c>
        SuexecUserGroup blog blog
    </IfModule>
    CustomLog /var/log/httpd/domains/blog.com.sub1.bytes bytes
    CustomLog /var/log/httpd/domains/blog.com.sub1.log combined
    ErrorLog /var/log/httpd/domains/blog.com.sub1.error.log
    <Directory /home/blog/domains/blog.com/public_html/sub1>
        AllowOverride AuthConfig FileInfo Indexes Limit Options=Indexes,IncludesNOEXEC,MultiViews,SymLinksIfOwnerMatch,FollowSymLinks,None
        Options -ExecCGI -Includes +IncludesNOEXEC
        <FilesMatch "\.(inc|php|phtml|phps|php56)$">
            <If "-f %{REQUEST_FILENAME}">
                #ProxyErrorOverride on
                AddHandler "proxy:unix:/usr/local/php56/sockets/blog.sock|fcgi://localhost" .inc .php .phtml .php56
            </If>
        </FilesMatch>
    </Directory>
</VirtualHost>

<VirtualHost 88.88.88.88:80 >
    ServerName www.sub1.domain3.com
    ServerAlias www.sub1.domain3.com sub1.domain3.com
    ServerAdmin [email protected]
    DocumentRoot /home/blog/domains/blog.com/public_html/sub1
    UseCanonicalName OFF
    <IfModule !mod_ruid2.c>
        SuexecUserGroup blog blog
    </IfModule>
    CustomLog /var/log/httpd/domains/blog.com.sub1.bytes bytes
    CustomLog /var/log/httpd/domains/blog.com.sub1.log combined
    ErrorLog /var/log/httpd/domains/blog.com.sub1.error.log
    <Directory /home/blog/domains/blog.com/public_html/sub1>
        AllowOverride AuthConfig FileInfo Indexes Limit Options=Indexes,IncludesNOEXEC,MultiViews,SymLinksIfOwnerMatch,FollowSymLinks,None
        Options -ExecCGI -Includes +IncludesNOEXEC
        <FilesMatch "\.(inc|php|phtml|phps|php56)$">
            <If "-f %{REQUEST_FILENAME}">
                #ProxyErrorOverride on
                AddHandler "proxy:unix:/usr/local/php56/sockets/blog.sock|fcgi://localhost" .inc .php .phtml .php56
            </If>
        </FilesMatch>
    </Directory>
</VirtualHost>
 
Guys, Can you tell me where is the script code that generate user httpd.conf file in directadmin?
 
/usr/local/directadmin/data/templates/virtual_host2*****
if you want to customize it - create folder /usr/local/directadmin/data/templates/custom/
and copy here any template for customization
 
/usr/local/directadmin/data/templates/virtual_host2*****
if you want to customize it - create folder /usr/local/directadmin/data/templates/custom/
and copy here any template for customization
Thanks, I know that custom Virtualhost
But i want to know what script generate the users httpd.conf file with that template?
I want to change that script to just generate Subdomain Virtualhost for main domain, not for all Domain Pointers
 
Back
Top