HTTP Configure Private Directories Flashcards

1
Q

Change the httpd.conf server admin and server name so they reflect the server you are working on

A

yum install httpd-manual httpd

vim /etc/hosts

10.1.152.56 we3kb1.mylabserver.com testweb.ourexample.com
vim /etc/httpd/conf/httpd.conf

ServerAdmin root@testweb.ourexample.com

ServerName testweb.ourexample.com
Test the syntax
httpd -t

Apply the configuration
systemctl restart httpd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Apply a private directory

A

mkdir /var/user1dir

chown user1:user1 /var/user1dir

chmod 711 /var/user1dir

echo “User1dir index.html” > /var/user1dir/index.html

semange fcontext -a -t

httpd_sys_content_t “/var/user1dir(/.*)?”

restorecon -Rv /var/user1dir

vim /etc/httpd/conf/httpd.conf

DocumentRoot “/var/”

AllowOverride AuthConfig

Check the syntax
httpd -t

Create a access file
cd /var/user1dir
vim .htaccess
AuthType Basic 
AuthName "Password Protected Directory" 
AuthUserFile "/etc/httpd/conf/.userdb"
Require user user1

Create a password for user1
cd /etc/httpd/conf/

htpasswd -c .userdb user1

chgrp apache .userdb
chmod 640 .userdb

systemctl restart httpd

elinks http://testweb.ourexample.com/user1dir

How well did you know this?
1
Not at all
2
3
4
5
Perfectly