From: Chris Koeritz Note: these instructions, even the quick approaches below, pale in
+ comparison to the ease of use of the "standup" command in feisty meow's
+ site avenger scripts. The standup command is detailed in the feisty
+ meow command reference document. These instructions are for
+ situations when the domain or site is idiosyncratic in some way that
+ standup doesn't support. To add a new website, you will first need to pick one of the DNS options
- below (A or B) depending on how you want to name the site.Adding a new website and domain on the guest VM
+
Once the DNS option has been picked and implemented, continue to the next + section of "Creating a New Apache Site".
+Let us say a customer needs an application called "excalibur". It will be a new subdomain within an existing domain, such as the "cakelampvm.com" domain, meaning we want the VM to start answering requests for "excalibur.cakelampvm.com".
-Connect to the cakelampvm via ssh as the developer user, e.g.: ssh + developer@cakelampvm.com
Run this command in a bash shell on the VM:
-add_domain excalibur.cakelampvm.com+
# add_domain excalibur.cakelampvm.com
Done.
Note: the manual approach is not compatible with later use of feisty + meow's "remove_domain".
Connect to the cakelampvm via ssh as the developer user, e.g.: ssh developer@cakelampvm.comExecute the following command to edit the DNS file for the cakelampvm domain:
-sudo vi /etc/bind/cakelampvm.com.conf+
# sudo vi /etc/bind/cakelampvm.com.conf
Add a stanza for the new site at the end of this file:
-greatsite.cakelampvm.com IN A 10.28.42.20-
IN HINFO "linux server" "ubuntu"
Restart the DNS server: sudo service bind9 restart
-Afterwards, pinging greatsite.cakelampvm.com should work from either the - guest or the host.
+excalibur.cakelampvm.com IN A 10.28.42.20+
IN HINFO "linux server" "ubuntu"
Restart the DNS server:
+# sudo service bind9 restart+
Afterwards, pinging excalibur.cakelampvm.com should work from both the + guest VM and the host PC.
Similar procedure to above, but we will create a new file for the new - domain and add it to the bind directory. For this example, we will - create a file called /etc/bind/greatsite.tv.conf for our new domain - greatsite.tv with these contents:
-$TTL 1W- The gnarly prefix stuff above the "greatsite.tv." listing establishes +
@ IN SOA @ fred.cakelampvm.com. (
2017100801 ; serial
2H ; refresh
8M ; retry
14D ; expiry
6H ) ; minimum
IN NS ns.cakelampvm.com.
IN MX 10 mail.cakelampvm.com.
# main domain for machine.
greatsite.tv. IN A 10.28.42.20
IN HINFO "linux server" "ubuntu"
This is a similar procedure to Option A, but we will create a totally new + config file for the new domain and add it to the bind directory. For + this example, we need to add the site "excalibur.tv" into the DNS.
+Connect to the cakelampvm via ssh as the developer user, e.g.: ssh + developer@cakelampvm.com
+Run this command in a bash shell on the VM:
+# add_domain excalibur.tv+
Done.
+Create a file called /etc/bind/excalibur.tv.conf for our new domain + excalibur.tv with these contents:
+$TTL 1W+ The gnarly prefix stuff above the "excalibur.tv." listing establishes configuration info for the new domain. This file relies on the existing cakelampvm.com infrastructure in DNS, such as the "ns" host, which - is the domain's name server. + is the domain's name server. However, the new domain does not + live inside the cakelampvm.com domain.
@ IN SOA @ fred.cakelampvm.com. (
2017100801 ; serial
2H ; refresh
8M ; retry
14D ; expiry
6H ) ; minimum
IN NS ns.cakelampvm.com.
IN MX 10 mail.cakelampvm.com.
# main domain for machine.
excalibur.tv. IN A 10.28.42.20
IN HINFO "linux server" "ubuntu"
Now that the config file is in place, edit "named.conf.local" to add the new file by adding this bit of configuration at the end:
-zone "greatsite.tv" in {-
file "/etc/bind/greatsite.tv.conf";
type master;
allow-query { any; };
};
Restart the DNS server: sudo service bind9 restart
-Afterwards, pinging greatsite.tv should work from either the guest or the +
zone "excalibur.tv" in {+
file "/etc/bind/excalibur.tv.conf";
type master;
allow-query { any; };
};
Restart the DNS server:
+# sudo service bind9 restart+
Afterwards, pinging excalibur.tv should work from both the guest and the host.
-Start with the following template file for the new website, and modify it for the appropriate host name:
<VirtualHost *:80>
ServerName greatsite.cakelampvm.com
ServerAlias greatsite.cakelampvm.com *.greatsite.cakelampvm.com
DocumentRoot /var/www/greatsite
ErrorLog ${APACHE_LOG_DIR}/greatsite.cakelampvm.com-error.log
CustomLog ${APACHE_LOG_DIR}/greatsite.cakelampvm.com-access.log combined
Alias /statistics "/var/www/webwork.repository/webwork/maps_demo/webroot/statistics"
Include /etc/apache2/conf-library/basic-options.conf
Include /etc/apache2/conf-library/rewrite-enabling.conf
</VirtualHost>