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:

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

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

Upcoming Events (Local Time)

There are no events.

RHCSA7: Task of the day

Allowed time: 15 minutes.
Get an iso image of CentOS 7 (or a DVD) and set up a local repository.

RHCE7: Task of the day

Allowed time: 10 minutes.
Set up a default secure MariaDB database called maria and create a table named people with two columns respectively name varchar(20) and age int(10) unsigned.

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