-
Notifications
You must be signed in to change notification settings - Fork 67
/
install-httpd.sh
70 lines (53 loc) · 1.56 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
#!/bin/bash
set -eu
# Software install
# ----------------
# Apache httpd
yum install -y 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
if [ "$(grep -oP '(?<= )[0-9]+(?=\.)' /etc/redhat-release)" -ge 7 ]; then
# turn off fire wall, Centos 7
systemctl disable firewalld
systemctl stop firewalld
else
# fallback, turn off fire wall, Centos 6
service iptables stop
chkconfig iptables off
fi