HTTP Configure Private Directories Flashcards Preview

RHCE > HTTP Configure Private Directories > Flashcards

Flashcards in HTTP Configure Private Directories Deck (2):
1

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

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

2

Apply a private directory

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