HTTP Configure Private Directories Flashcards Preview

RHCE > HTTP Configure Private Directories > Flashcards

Flashcards in HTTP Configure Private Directories Deck (2):

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
vim /etc/httpd/conf/httpd.conf


Test the syntax
httpd -t

Apply the configuration
systemctl restart httpd


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