My environment is ubuntu and my domain has already been installed. We already operate another site in the original domain. What I’d like to do is to operate a different language version of the original site in the subdomain, but I do not know how to do it. So I want you to tell me that. Now, accessing the subdomain shows the same site as the original. We also set subdomains from the administration screen. (Subdomain is ‘test’.) I made both A and CHAME and entered as follows.
root @ ubuntu - s - 1 vcpu - 1 gb - blr 1 - 01: ~ # cd / var / www
root @ ubuntu - s - 1 vcpu - 1 gb - blr 1 - 01: / var / www # ls
html
root @ ubuntu - s - 1 vcpu - 1 gb - blr 1 - 01: / var / www # mkdir subdomain
root @ ubuntu - s - 1 vcpu - 1 gb - blr 1 - 01: / var / www # ls
html subdomain
root @ ubuntu - s - 1 vcpu - 1 gb - blr 1 - 01: / var / www # chmod - R 755 subdomain
root @ ubuntu - s - 1 vcpu - 1 gb - blr 1 - 01: / var / www # ls
html subdomain
root @ ubuntu - s - 1 vcpu - 1 gb - blr 1 - 01: / var / www # ls - l
total 8
drwxr-xr-x 2 root root 4096 Aug 13 07: 06 html
drwxr - xr - x 2 root root 4096 Sep 16 05: 40 subdomain
root @ ubuntu - s - 1 vcpu - 1 gb - blr 1 - 01: / var / www # ls - l
total 8
drwxr-xr-x 2 root root 4096 Aug 13 07: 06 html
drwxr - xr - x 2 root root 4096 Sep 16 05: 40 subdomain
root @ ubuntu - s - 1 vcpu - 1 gb - blr 1 - 01: / var / www # cd subdomain /
root @ ubuntu - s - 1 vcpu - 1 gb - blr 1 - 01: / var / www / subdomain # sudo nano index.php
(Here suitably
<? php
echo 'It works !!';
?>
I will leave it aside. )
root @ ubuntu - s - 1 vcpu - 1 gb - blr 1 - 01: / var / www / subdomain # cd
root @ ubuntu - s - 1 vcpu - 1 gb - blr 1 - 01: ~ # sudo apt - get update
Reading package lists ... Done
root @ ubuntu - s - 1 vcpu - 1 gb - blr 1 - 01: ~ # cd / etc / apache 2 / sites - available
root @ ubuntu - s - 1 vcpu - 1 gb - blr 1 - 01: / etc / apache 2 / sites - available # ls
000-default.conf 000-default-le-ssl.conf default-ssl.conf
root @ ubuntu - s - 1 vcpu - 1 gb - blr 1 - 01: / etc / apache 2 / sites - available # cp 000 - default.conf test.com.conf
root @ ubuntu-s-1vcpu-1gb-blr1-01: / etc / apache2 / sites-available # sudo nano test.com.conf
(Here's how I changed it.
ServerName www.example.com → ServerName test.mydomain.com
+ ServerAlias www.mydomain.com
DocumentRoot / var / www / html -> DocumentRoot / var / www / subdomain
)
root @ ubuntu-s-1vcpu-1gb-blr1-01: / etc / apache2 / sites-available # sudo a2ensite test.com.conf
Enabling site test.com.
root @ ubuntu - s - 1 vcpu - 1 gb - blr 1 - 01: / etc / apache 2 / sites - available # sudo a 2 dissite 000 - default.conf
Site 000-default disabled.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.