DocumentRoot is not recognized for subdomain.

reez

New member
Joined
Jan 16, 2017
Messages
1
Hello,

I have the following question http://serverfault.com/questions/826569/documentroot-for-subdomain-not-recognized-in-directadmin posted at serverfault but I didn't get any questions so I am going to try it at the source now.

I have created a subdomain for my api. This points by default to

>domain.tld/api

Which is fine. But I want the documentroot to point to

>/home/user/domains/domain.tld/public_html/api/public

I have changed this in DirectAdmin and restarted httpd. daemon. The httpd.conf shows the right settings. But I still have to go to

>domain.tld/api/public

In order to visit my api. What am I doing wrong?

This is my whole virtualhost config for this subdomain.

<VirtualHost IPADDRESS:80 [2a01:7c8:fffa:1e4:0:0:0:1]:80 >
ServerName www.api.domain.tld
ServerAlias www.api.domain.tld api.domain.tld
ServerAdmin [email protected]
DocumentRoot /home/user/domains/domain.tld/public_html/api/public
UseCanonicalName OFF
<IfModule !mod_ruid2.c>
SuexecUserGroup user user
</IfModule>

<FilesMatch "\.(inc|php|phtml|phps|php71)$">
AddHandler "proxy:unix:/usr/local/php71/sockets/user.sock|fcgi://localhost" .inc .php .phtml .php71
</FilesMatch>
<Directory /home/user/domains/domain.tld/public_html/api/public>
AllowOverride AuthConfig FileInfo Indexes Limit Options=Indexes,Includes,IncludesNOEXEC,MultiViews,SymLinksIfOwnerMatch,FollowSymLinks,None
Options -ExecCGI
</Directory>
</VirtualHost>
 
Hello,

You changed document root for subdomain, so you should access api.domain.tld. With this you won't see content from domain.tld/api/public/ when you access domain.tld/api/
 
Back
Top