Subdomains in different path

ShinJii

Verified User
Joined
Mar 20, 2014
Messages
224
Hi,
I read this thread - http://forum.directadmin.com/showthread.php?t=21754 and this http://help.directadmin.com/item.php?id=199 and in admin level I insert in textarea in httpd.conf this:
|*if SUB|
|?DOCROOT=/home/acdm/domains/***.pl/public_html/subdomains|
|*endif|

Now it shows in subdomains below textarea something like this:
ServerName www.testttt.***.pl
ServerAlias www.testttt.***.pl testttt.***.pl
ServerAdmin webmaster@***.pl
DocumentRoot /home/acdm/domains/***.pl/public_html/subdomains/testttt

But in configuration check
AH00112: Warning: DocumentRoot [/home/acdm/domains/***.pl/public_html/subdomains/testttt] does not exist
Syntax OK

When I create subdomains in DA it still create folders in ROOT (public_html) not in public_html/subdomains/ why???
 
Last edited:
Hello,

Whether or not you specify a new location for your subdomains in a virtual host conig, that is up to you to create a new directory structure. In order to make the process to run automatically on a subdomain creation you can utilize directadmin hooks for it, i.e. PRE/POST scripts. Use help.directadmin.com to find more details on them, search for post.sh.
 
So can I in php do exec() command with delete dir from ROOT and create this dir in /subdomains/ after call CMD_API_SUBDOMAINS ?
 
Ok I did script in PHP and all works but why I don't have access to .css, .js etc. files? It's 404 error...but for example .html works for the same path...
404 Not Found
nginx

I have nginx_apache in custombuild. But when I changed it to only apache and restart httpd and directadmin it's still error 404 with nginx not apache in footer... I don't know why...
 
If you want to get a proper answer you should either give us more information regarding your configuration including a final virtualhost config, or get someone to check it on your server.
 
DA 1.50, php 7.0.7, nginx_apache, centos 7

<VirtualHost ***:8080 127.0.0.1:8080 >
ServerName www.test.***.pl
ServerAlias www.test.***.pl test.***.pl
ServerAdmin webmaster@***.pl
DocumentRoot /home/acdm/domains/***.pl/public_html/subdomains/test
ScriptAlias /cgi-bin/ /home/acdm/domains/***.pl/public_html/subdomains/test/cgi-bin/
UseCanonicalName OFF
<IfModule !mod_ruid2.c>
SuexecUserGroup acdm acdm
</IfModule>
<IfModule mod_ruid2.c>
RMode config
RUidGid acdm acdm
#RGroups apache access
RGroups @none
</IfModule>
CustomLog /var/log/httpd/domains/***.pl.test.bytes bytes
CustomLog /var/log/httpd/domains/***.pl.test.log combined
ErrorLog /var/log/httpd/domains/***.pl.test.error.log
<Directory /home/acdm/domains/***.pl/public_html/subdomains>
php_admin_flag engine ON
php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f acdm@***.pl'
php_admin_value mail.log /home/acdm/.php/php-mail.log
php_admin_value open_basedir /home/acdm/:/tmp:/var/tmp:/usr/local/lib/php/:/usr/local/php70/lib/php/
</Directory>
</VirtualHost>

.htaccess:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]
AddDefaultCharset UTF-8
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z\-0-9\_]+).html?$ index.php?verb=$1 [QSA,L]
RewriteCond %{REQUEST_URI} \.(tpl|tpl.php|inc.php)$
RewriteRule .* - [F]

Nginx error log and Apache error log is clear....


Enough info? or should I paste something more? if yes what should I paste?

Like I said .php, .html works but .css,.js,.png,.jpg doesn't, so it's because of what? I have no idea...nginx,apache?
 
Last edited:
Try and open www.test.***.pl through apache only on port 8080.

If you want a quicker assistance you might consider hiring somebody for this. These are forums...

Still no images,js,css... but on main domain it's all good... :/... it's because I changed the path in httpd conf to subdomains? Or what... but it's weird if .php and .html works on every path in subdomain. Maybe should I change something in nginx??
 
I did build again Apache in CB 2.0 , after that update was available - nginx from 1.10.0 to 1.10.1, I updated and now it works...weird ;)
 
But in Custom HTTPD Configurations -> nginx proxy is something like this:
location /nginx_static_files/
{
# access_log /var/log/nginx/access_log_proxy;
alias /home/acdm/domains/***.pl/public_html/akademia/;
internal;
}

How to change this to be automatic like in my first post?
alias /home/acdm/domains/***.pl/public_html/subdomains/akademia/;

This not work in nginx_proxy
|*if SUB|
|?DOCROOT=/home/acdm/domains/***.pl/public_html/subdomains|
|*endif|
 
Still no images,js,css... but on main domain it's all good... :/... it's because I changed the path in httpd conf to subdomains? Or what... but it's weird if .php and .html works on every path in subdomain. Maybe should I change something in nginx??

No images can be easily explained if you use Absolute Paths to load them, in such a case they will still try to load via post :80 through nginx.

How to change this to be automatic like in my first post? This not work in nginx_proxy

Check the list of available TOKENS and use the correct one. Also check what TOKEN is used in the template: /usr/local/directadmin/data/templates/nginx_server_sub.conf They differ from Apache's.
 
Hi again,
Now I have a problem with apache, I want to change path for ONLY ONE subdomain without adding `SUBDOMAIN name` at the end of path... so I read this: https://help.directadmin.com/item.php?id=199 and I have something like this in httpd config:
Code:
|?REALDOCROOT=/home/acdm/domains/*.pl/public_html/subdomains/subdomain|
|?DOCROOT=`REALDOCROOT`|
|*if SUB="panel"|
|?CGI=ScriptAlias /cgi-bin/ `DOCROOT`/cgi-bin/|
DocumentRoot |DOCROOT|
|*endif|

After this I have 2 Document Roots in this subdomain... one with good path (from above code)
Code:
/home/acdm/domains/*.pl/public_html/subdomains/subdomain/
and one with `SUB` at the end
Code:
/home/acdm/domains/*.pl/public_html/subdomains/subdomain/panel/
.... how to delete this second path? I know it's probably added and loaded from virtual_host2_sub.conf... but it's possible to change this only for this one subdomain? Because this tutorial in above URL is for all subdomains...
 
Last edited:
Anyone? I need to know that fast.
Here's httpd conf after above changes:
Code:
<VirtualHost ip >
DocumentRoot /home/acdm/domains/****/public_html/subdomains/***
	ServerName www.panel.***.org
	ServerAlias www.panel.***.org panel.***.org 
	ServerAdmin webmaster@***.org
	DocumentRoot /home/acdm/domains/****/public_html/subdomains/***/panel
	ScriptAlias /cgi-bin/ /home/acdm/domains/****/public_html/subdomains/***/cgi-bin/
	UseCanonicalName OFF
 
When I did only 1st point it didn't work... it add name of subdomain at the end of path.
When I did 2nd point it works for all subdomains... but I want only for this one....

This code above is after testing this guide which didn't work... so I wanted to test some different codes :P
 
Back
Top