File tree 3 files changed +27
-11
lines changed
3 files changed +27
-11
lines changed Original file line number Diff line number Diff line change @@ -15,10 +15,22 @@ manually configure a few things:
15
15
16
16
1 . Edit <code >docroot/wp-config-local.php</code > and fill in values as
17
17
needed by WordPress.
18
- 2 . Set up SSL keys in /etc/ssl/*
19
- 3 . Edit /etc/apache2/sites-available/(hostname) if needed (e.g. to
20
- change SSL key locations)
21
- 4 . Load DB data from another WordPress install (see below)
18
+ 2 . Set up SSL keys in /etc/ssl/private. If there isn't a key for the
19
+ hostname being set-up, then the Apache config will not include an
20
+ SSL virtual host. Simply re-run the setup script if you add a key.
21
+ 3 . If desired, load DB data from another WordPress install (see below)
22
+
23
+ ### Editing the Apache config
24
+
25
+ If you need to edit the Apache config, the files are:
26
+
27
+ * <code >apache.conf</code >: CC Apache config in macro form.
28
+ * <code >/etc/apache2/httpd.conf</code >: Includes the
29
+ <code >apache.conf</code > file in this checkout.
30
+ * <code >/etc/apache2/sites-available/<hostname ></code >: Virtual host
31
+ definition which uses a macro defined in <code >apache.conf</code > to
32
+ pull in a lot of rules and settings. This file gets overwritten by
33
+ the setup script, so if you edit it, do not run it again.
22
34
23
35
### Loading DB data
24
36
Original file line number Diff line number Diff line change 3
3
TOPDIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) /.." && pwd ) "
4
4
5
5
function usage {
6
- echo " Usage: $0 <hostname>
6
+ echo " Usage: $0 <hostname>"
7
7
exit 1
8
8
}
9
9
[ -z " $1 " ] && usage;
Original file line number Diff line number Diff line change 36
36
fi
37
37
38
38
cat << EOF > /etc/apache2/sites-available/${HOSTNAME}
39
- <VirtualHost * :8080>
39
+ <VirtualHost ${HOSTNAME} :8080>
40
40
Use CCVHost ${HOSTNAME} http ${TOPDIR} /var/log/apache2/${HOSTNAME}
41
41
</VirtualHost>
42
+ EOF
42
43
43
- <VirtualHost *:443>
44
+ if [ -f /etc/ssl/private/${HOSTNAME} .key ]
45
+ then
46
+ cat << EOF >> /etc/apache2/sites-available/${HOSTNAME}
47
+ <VirtualHost ${HOSTNAME} :443>
44
48
Use CCVHost ${HOSTNAME} https ${TOPDIR} /var/log/apache2/${HOSTNAME}
45
49
SSLEngine on
46
50
SSLCertificateFile /etc/ssl/private/${HOSTNAME} .crt
47
51
SSLCertificateKeyFile /etc/ssl/private/${HOSTNAME} .key
48
52
SSLCACertificateFile /etc/ssl/certs/RapidSSL_CA_bundle.pem
49
53
</VirtualHost>
50
54
EOF
55
+ fi
51
56
52
57
# 2. Create logging directory
53
58
54
- mkdir /var/log/apache2/${HOSTNAME}
59
+ mkdir -p /var/log/apache2/${HOSTNAME}
55
60
chown root.adm /var/log/apache2/${HOSTNAME}
56
61
chmod 750 /var/log/apache2/${HOSTNAME}
57
62
@@ -74,7 +79,6 @@ service apache2 restart
74
79
75
80
echo " Enter the MySQL root password:"
76
81
mysql -u root -p mysql << EOF
77
- CREATE DATABASE ${DBNAME} ;
78
- CREATE USER '${DBUSER} '@'localhost' IDENTIFIED BY '${DBPASS} ';
79
- GRANT ALL PRIVILEGES ON *.* TO '${DBUSER} '@'localhost' WITH GRANT OPTION;
82
+ CREATE DATABASE IF NOT EXISTS ${DBNAME} ;
83
+ GRANT ALL ON ${DBNAME} TO '${DBUSER} '@'localhost' IDENTIFIED BY '${DBPASS} ';
80
84
EOF
You can’t perform that action at this time.
0 commit comments