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...
2 comments on “HTTP: Configure group-managed content.
  1. waynedovey says:

    Don’t forget this part

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

Leave a Reply

RHCSA7: Task of the day

Allowed time: 5 minutes.
Create two users "tom" and "engine". "tom" has the UID/GID 3000 and "engine" the UID/GID 4000. "engine" doesn't have an interactive shell.

RHCE7: Task of the day

Allowed time: 15 minutes.
Configure a httpd server with a password protected directory under the /var/www/html/private directory.

Follow me on Twitter

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 ...

Archives