restrict access to a webpage
Ovetta is a RHEL Manager at Red Hat. RedHat.com is served up using Apache web server, and the ip address is 52.200.142.250. Ovetta wants to restrict access to redhat.com/developers/ to anyone in the "developers" group on RHEL_Server_01. How is she going to do it?
To restrict access to the "/developers/" directory on the Red Hat server (RHEL_Server_01) to only members of the "developers" group, Ovetta can follow these steps:
Log in to RHEL_Server_01 as the root user or a user with administrative privileges.
Install the Apache web server if it's not already installed on the server. Ovetta can use the following command to install Apache:
- sudo dnf install httpd
- sudo dnf install httpd
- Once Apache is installed, navigate to the Apache configuration directory:
- cd /etc/httpd/conf.d/
- Create a new configuration file specifically for the "/developers/" directory:
- sudo vi developers.conf
- This will open the file in the vi text editor. If vi is not familiar, any other text editor can be used.
- In the configuration file, add the following directives to restrict access to the "/developers/" directory:
- <Directory "/var/www/html/developers">
Require group developers
</Directory> - Adjust the path "/var/www/html/developers" if the actual path differs. This assumes that the "/var/www/html" directory is the DocumentRoot for the Red Hat website.
- <Directory "/var/www/html/developers">
Save and close the file. In vi, press Esc, then type
:wq
and hit Enter.Restart the Apache web server to apply the configuration changes:
- sudo systemctl restart httpd
Now, only members of the "developers" group will have access to the "/developers/" directory on the Red Hat server when accessing the website via Apache. Other users or groups will be denied access.