🐧
Linux
  • syllabus
  • unit 1-Introduction
    • Unit I: Introduction to Linux
    • 2. Advantages of Linux over other operating systems
    • 3.File systems
    • 4.Culture of free software
  • unit 2-Basics of Linux
    • 1.Commands
    • 2.shell
    • 3.Text Editors
    • 4.The file system of Linux
    • 5.Directories and their special purpose
    • 6.permission
  • unit 3-Installation
    • 1. Partitioning
    • 2. Installation of Linux
    • 3. Troubleshooting of installation
  • unit 4-System Administration
    • 1.Root login
    • 2.Superuser
    • 3.Configuration of hardware with kudzu
    • 4. Checking System Space:
    • 5. Monitoring System Performance:
    • 6. Working with a File System:
    • 7.Configuring modules
    • 8.jail shell
    • 9.awk
    • 10.sed
  • unit 5-User Management
    • 1.Creating user accounts
    • 2.Setting user defaults
    • 3.Providing support to users
    • 4.Modifying accounts
    • 5.Deleting user accounts
    • 6.Checking disk quotas
    • 7.Sending mail to all users
  • unit 6-Security and System Handling
    • 1.Understanding shell scripts
    • 2.System startup and shutdown
    • 3.Scheduling system tasks
    • 4.Backing up and restoring
    • 5.Password protection
    • 6.File security
  • unit 7-Setting up a Web Server
    • 1.Introduction to a web server
    • 2.Starting the Apache webserver
    • 3.Configuring the Apache webserver
    • 4.Monitoring server activities
  • unit 8-Setting up DHCP and NIS
    • 1.Introduction to DHCP
    • 2.Setting up DHCP Server
    • 3.Setting up DHCP Client
    • 4.Understand NIS
  • unit 9-Setting up a Database Server
    • 1.Configuring database server
    • 2.Checking the status
    • 3.Working with database
  • unit 10-Setting up DNS
    • 1.Introduction to DNS
    • 2.Setting up DNS and configuration
    • 3.Querying DNS
  • unit 11-ISP Simulation
    • 1.Integration of servers
    • 2.DNS, Web, Email, etc
  • fullform
  • Assignment
  • Practicals
    • 1.Linux utilities
    • 2.OS installation project work
    • 3.User management using a terminal
    • 4.Security level access control list
    • 1.Network setting
    • 2.Server configuration of DHCP, DNS, Database server
    • 3.Demonstration of the web, mail, file server
  • imp questions
    • short-notes
    • unit 1
    • unit 2
    • unit 3
    • unit 4
    • unit 5
    • unit 6
    • unit 7
    • unit 8
    • unit 9
    • unit 10
    • unit 11
    • unit ii
  • services
    • create_service
  • Viva+Practical
    • VIVA questions
    • Practical questions
Powered by GitBook
On this page

Was this helpful?

  1. unit 7-Setting up a Web Server

3.Configuring the Apache webserver

1. Change the Server Name and Port:

File to Edit: httpd.conf or apache2.conf

Purpose: To set the server's hostname and port.

Steps:

  • Open the Apache configuration file. On Ubuntu/Debian, it's typically /etc/apache2/apache2.conf. On CentOS/RHEL, it's usually /etc/httpd/conf/httpd.conf.

  • Look for the ServerName directive and set it to your desired hostname:

ServerName yourhostname.com
  • If you want to change the default HTTP port (80), modify the Listen directive:

Listen 8080

2. Create a Virtual Host:

File to Edit: Create a new configuration file in the sites-available directory (on Debian/Ubuntu) or /etc/httpd/conf.d (on CentOS/RHEL).

Purpose: To host multiple websites or applications on the same Apache server.

Steps:

  • Create a new configuration file for your virtual host, e.g., mywebsite.conf:

For Ubuntu/Debian:

sudo nano /etc/apache2/sites-available/mywebsite.conf

For CentOS/RHEL:

sudo nano /etc/httpd/conf.d/mywebsite.conf
  • Add a configuration block for your virtual host, specifying the server name, document root, error log, and custom log:

<VirtualHost *:80>
    ServerAdmin webmaster@yourwebsite.com
    ServerName yourwebsite.com
    DocumentRoot /var/www/html/yourwebsite
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
  • Save the file and exit the text editor.

  • Enable the virtual host:

For Ubuntu/Debian:

sudo a2ensite mywebsite.conf

For CentOS/RHEL, if you placed the configuration file in /etc/httpd/conf.d, it should be automatically enabled.

3. Secure the Web Server with SSL/TLS:

File to Edit: /etc/apache2/sites-available/default-ssl.conf (on Debian/Ubuntu) or /etc/httpd/conf.d/ssl.conf (on CentOS/RHEL).

Purpose: To enable HTTPS for secure connections.

Steps:

  • Ensure you have SSL/TLS certificates installed on your server. You can obtain certificates from a Certificate Authority or use Let's Encrypt.

  • Edit the SSL virtual host configuration file:

For Ubuntu/Debian:

sudo nano /etc/apache2/sites-available/default-ssl.conf

For CentOS/RHEL:

sudo nano /etc/httpd/conf.d/ssl.conf
  • Update the SSLCertificateFile and SSLCertificateKeyFile directives with the paths to your certificate and private key files:

SSLCertificateFile /path/to/your/certificate.crt
SSLCertificateKeyFile /path/to/your/privatekey.key
  • Save the file and exit the text editor.

4. Implement Access Control:

File to Edit: Virtual host configuration file (e.g., mywebsite.conf)

Purpose: To control access to specific directories or resources.

Steps:

  • Open the virtual host configuration file you created earlier.

  • Add directives to specify access control. For example, to restrict access to a directory:

<Directory /var/www/html/yourwebsite/restricted>
    Require all denied
</Directory>

This example denies access to the /var/www/html/yourwebsite/restricted directory for all users.

  • Save the file and exit the text editor.

5. Enable .htaccess Overrides (Optional):

File to Edit: Virtual host configuration file (e.g., mywebsite.conf)

Purpose: To allow per-directory configuration using .htaccess files.

Steps:

  • Open the virtual host configuration file.

  • Add the AllowOverride directive within a <Directory> block to specify which directives can be overridden by .htaccess files:

<Directory /var/www/html/yourwebsite>
    AllowOverride All
</Directory>

This example allows all directives to be overridden using .htaccess files in the /var/www/html/yourwebsite directory.

  • Save the file and exit the text editor.

6. Restart Apache:

After making configuration changes, restart the Apache web server to apply the changes:

For Ubuntu/Debian:

sudo systemctl restart apache2

For CentOS/RHEL:

sudo systemctl restart httpd

These steps should help you configure Apache for various common tasks. Remember to adapt the configurations to your specific use case and requirements.

Previous2.Starting the Apache webserverNext4.Monitoring server activities

Last updated 1 year ago

Was this helpful?