Question

How to edit the site of the subdomain

Posted September 16, 2018 1k views
UbuntuApache

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.
Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!