forked from rundeck/anvils-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-httpd.sh
74 lines (55 loc) · 1.57 KB
/
install-httpd.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
set -eu
# Software install
# ----------------
#
# Utilities
# Bootstrap a fedora repo to get lighttpd
if ! rpm -q epel-release
then
rpm -Uvh https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
fi
yum install -y httpd xmlstarlet
# Apache httpd
# ------------
# Create directory for webdav lock files
mkdir -p /var/lock/apache
chown apache:apache /var/lock/apache
# Create a login for accessing the webdav content.
(echo -n "admin:DAV-upload:" && echo -n "admin:DAV-upload:admin" |
md5sum |
awk '{print $1}' ) >> /etc/httpd/webdav.passwd
# Generate the configuration into the includes directory.
cat > /etc/httpd/conf.d/webdav.conf<<EOF
DavLockDB /var/lock/apache/DavLock
Alias /rundeck "/var/www/html"
<Directory /var/www/html>
Dav On
Order Allow,Deny
Allow from all
AuthType Digest
AuthName DAV-upload
# You can use the htdigest program to create the password database:
# htdigest -c "/etc/httpd/webdav.passwd" DAV-upload admin
AuthUserFile "/etc/httpd/webdav.passwd"
AuthDigestProvider file
# Allow universal read-access, but writes are restricted
# to the admin user.
<LimitExcept GET OPTIONS>
require user admin
</LimitExcept>
</Directory>
EOF
# Create subdirectories for webdav content.
mkdir -p /var/www/html/anvils
cat > /var/www/html/anvils/hi.txt<<EOF
hi
EOF
chown -R rundeck:apache /var/www/html/anvils
# start the httpd service
service httpd start
# Ensure httpd is started on reboot of machine
chkconfig httpd on
# turn off fire wall
service iptables stop
chkconfig iptables off