Operating system: Ubuntu
OS version: 18.04
I’ve read a dozen articles on it but couldn’t figure out a simple solution to a simple problem. I have a server setup in virtualmin example.com and now I want to create a subdomain test.example.com that should point to the directory
/home/example/public_html/test/. I’m not able to achieve this.
I’ve tried creating sub servers, then changing their
DocumentRoot, alias servers and even tried manually. So no server for test.example.com, then added a file
/etc/apache2/sites-enabled/test.example.com.conf. In it I added
<VirtualHost *:80> ServerName test.example.com Redirect 301 / https://test.example.com/ </VirtualHost> <VirtualHost *:443> ServerName test.example.com ServerAlias test.example.com DocumentRoot "/home/example/public_html/test" AccessFileName .htaccess <Directory "/home/example/public_html/test"> Order allow,deny Allow from All AllowOverride All </Directory> </VirtualHost>
But it doesn’t work. The domain takes me to the alphabetically first server which is what happens when a server isn’t setup. Please help.