HTTP: Configure group-managed content.

Share this link

Install the “Web Server” package group:

# yum groupinstall -y "Web Server"

Edit the /etc/hosts file and add the ip address and the fully qualified domain name of the server:

1.2.3.4 server.example.com

To allow only a group of users (here nikos and steve from the team) to access a specific directory (here private), edit the /etc/httpd/conf/httpd.conf file and type:

<Directory "/var/www/html/private">
AuthType Basic
AuthName "Password protected area"
AuthGroupFile /etc/httpd/conf/team
AuthUserFile /etc/httpd/conf/passwd
Require group team
</Directory>

Check the configuration file:

# service httpd configtest
Syntax OK

Create the private directory:

# mkdir -p /var/www/html/private
# restorecon /var/www/html/private

Create the /etc/httpd/conf/team file:

team: nikos steve

Create the /etc/httpd/conf/passwd file:

# htpasswd -c /etc/httpd/conf/passwd nikos
New password: nikos
Re-type new password: nikos
Adding password for user nikos
# htpasswd /etc/httpd/conf/passwd steve
New password: steve
Re-type new password: steve
Adding password for user steve

Add a new rule to the firewall:

# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT

Save the firewall configuration:

# service iptables save

Activate the httpd service at boot:

# chkconfig httpd on

Start the httpd service:

# service httpd start

Check the httpd service:

# yum install -y elinks
# elinks http://localhost/private/
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Leave a Reply

2 Comments on "HTTP: Configure group-managed content."

Notify of
Sort by:   newest | oldest
waynedovey
Member
waynedovey

Don’t forget this part

Alias /private/ “/var/www/html/private/”

wpDiscuz

RHCSA7: Task of the day

Allowed time: 8 minutes.
Find all files bigger than 100MB and write their names into the /root/results.txt file.

RHCE7: Task of the day

Allowed time: 10 minutes.
Set up a caching-only DNS server to forward DNS queries.

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...

Recent Comments