Linux + CentOS7 + Redhat 1. Install an Apache web server on one of your VMs and
ID: 3848864 • Letter: L
Question
Linux + CentOS7 + Redhat
1. Install an Apache web server on one of your VMs and verify that it works.
2. Create a DNS entry for the new web server and verify replication occurs.
3. Setup the web server to support secure connections over HTTPS.
4. Setup userdir support so that any user that has an account on the web server can setup a personal web space at ~/username (hint: think of how chewy works).
5. Explore how to use .htaccess and .htpasswd files, implement a static web page that allows access to the page only over an HTTPS connection and also prompts the user to enter a username and password.
Any guidance on commands would be great. Thank You!
Explanation / Answer
1. Installing an Apache web server:
Enter below command in terminal to install Apache web server
yum install httpd
Then you need to configure the Apache. Open below file
/etc/httpd/conf/httpd.conf
Create below configuration file for website to be hosted in your apche server.
Add below lines to the config file you just created. It will enable Apache to host xyz.com on port 80
Now start the apache. Enter below command in terminal.
service httpd start
2. Adding a DNS entry for the new web server:
Open below line
/etc/bind/named.conf.local
Now add below lines
zone "xyz.com" {
type master;
file "/etc/bind/db.xyz.com.conf";
};
Restart DNS server
service named restart
3. Setup the web server to support secure connections over HTTPS.
To do this you need to add few lines to apache configuration as below
<VirtualHost *:80>
ServerAdmin admin@xyz.com
ServerName xyz.com
ServerAlias www.xyz.com
DocumentRoot /var/www/xyz.com/public_html
SSLEngine on
SSLCertificateFile /path/to/your_domain_name.crt
SSLCertificateKeyFile /path/to/your_private.key
SSLCertificateChainFile /path/to/DigiCertCA.crt
<VirtualHost *:80>
Please note:
your_private.key : this is generated by you using below command
openssl genrsa -des3 -out private.pem 2048
your_domain_name.crt : Provided by certificate provider autority
DigiCertCA.crt : Provided by certificate provider autority
5. To force using HTTPS only you need to add .htaccess file in root folder of document directory of your website. Add below lines to .htaccess file
To user .htpasswd authentication add some extra configuration as below to your website configuration
<VirtualHost *:80>
ServerAdmin admin@xyz.com
ServerName xyz.com
ServerAlias www.xyz.com
DocumentRoot /var/www/xyz.com/public_html
<Directory "/var/www/html">
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Directory>
<VirtualHost *:80>
Now edit below file
/etc/apache2/apache2.conf
Change configuration as below
Now restart apache
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.