1 |
|
2 |
semanage fcontext -at httpd_sys_rw_content_t "/srv(/.*)?" |
3 |
|
4 |
yum install firewalld -y |
5 |
systemctl start firewalld |
6 |
systemctl enable firewalld |
7 |
firewall-cmd --permanent --zone=public --add-interface=eth0 |
8 |
firewall-cmd --permanent --add-service=http --zone=public |
9 |
firewall-cmd --reload |
10 |
|
11 |
systemctl start httpd |
12 |
systemctl enable httpd |
13 |
|
14 |
htpasswd -b -c /srv/website-password dbetz mypassword |
15 |
htpasswd -b /srv/website-password user01 stuff |
16 |
|
17 |
# password area (http://localhost/stuff) |
18 |
|
19 |
cat >> /etc/httpd/conf/httpd.conf << EOF |
20 |
|
21 |
Order allow,deny |
22 |
Allow from 10.0.0.0/8 |
23 |
AuthType Basic |
24 |
AuthName "apache sucks" |
25 |
AuthUserFile /srv/website-password |
26 |
Require user dbetz |
27 |
|
28 |
EOF |
29 |
|
30 |
mkdir /var/www/html/stuff |
31 |
cat > /var/www/html/stuff/index.html << EOF |
32 |
stuff here |
33 |
EOF |
34 |
|
35 |
# home dirs (http://localhost/~dbetz) |
36 |
setsebool -P httpd_enable_homedirs 1 |
37 |
sed -i "s/#UserDir public_html/UserDir public_html/;s/ UserDir disabled/ #UserDir disabled/" /etc/httpd/conf.d/userdir.conf |
38 |
|
39 |
mkdir /home/dbetz/public_html |
40 |
chmod 701 /home/dbetz |
41 |
chmod 701 /home/dbetz/public_html |
42 |
|
43 |
cat > /home/dbetz/public_html/index.html << EOF |
44 |
home here |
45 |
EOF |
46 |
|
47 |
restorecon -R -v /srv |
48 |
chown -R nobody:apache /srv |
49 |
|
50 |
systemctl restart httpd |
51 |
|