0% found this document useful (0 votes)
13 views

Web Server and Database Management

Uploaded by

irtzaarts
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Web Server and Database Management

Uploaded by

irtzaarts
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

This document is the property of Al Nafi.

Any unauthorized redistribution or reproduction, including in printed form, is strictly


prohibited. This document can only be read electronically.

Lab 19: Web Server and Database Management

Objective:
The objective of this lab is to manage web servers and databases on Linux.

td
Detailed Steps:

tl
1. Install and Configure Apache or Nginx:

Pv
● Choose a web server such as Apache or Nginx.
● Install the selected web server on your Linux system.

ng
# For Apache:
sudo apt install apache2
ni
ar
# For Nginx:
sudo apt install nginx
Le

● Start and enable the web server service.


IE

sudo systemctl start apache2 # For Apache


AF

sudo systemctl enable apache2


# For Nginx:
sudo systemctl start nginx # For Nginx
sudo systemctl enable nginx
N
AL

● Configure the web server to serve HTML pages and handle incoming requests.

2. Host a Basic HTML Page on the Web Server:


● Create a basic HTML page and save it in the web server's document root
directory.
<!-- /var/www/html/index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Website</title>
</head>
<body>
<h1>Welcome to My Website</h1>

td
<p>This is a basic HTML page hosted on the web server.</p>
</body>

tl
</html>

Pv
● Access the HTML page via a web browser by navigating to http://localhost or
the IP address of your server.

ng
3. Install MySQL or PostgreSQL:
ni
● Choose a database management system such as MySQL or PostgreSQL.
ar
● Install the selected database management system on your Linux system.
Le

# For MySQL:
sudo apt install mysql-server
# For PostgreSQL:
IE

sudo apt install postgresql


AF

● Start and enable the database service.


N

sudo systemctl start mysql # For MySQL


sudo systemctl enable mysql
AL

# For PostgreSQL:
sudo systemctl start postgresql # For PostgreSQL
sudo systemctl enable postgresql

4. Create a Database and a Basic Table, Perform Simple SQL


Queries:
● Connect to the MySQL or PostgreSQL database server.

# For MySQL:
sudo mysql -u root -p
# For PostgreSQL:
sudo -u postgres psql

td
● Create a new database.

tl
Pv
CREATE DATABASE my_database;

● Create a basic table in the database.

ng
CREATE TABLE my_table (
id INT PRIMARY KEY,
ni
ar
name VARCHAR(50)
);
Le

● Perform simple SQL queries such as inserting data into the table, querying data
from the table, updating records, and deleting records.
IE

Conclusion:
AF

This lab has provided hands-on experience in managing web servers and databases on
Linux. Participants have learned how to install and configure Apache or Nginx as web
N

servers, host a basic HTML page, install MySQL or PostgreSQL as database


management systems, create databases and tables, and perform simple SQL queries.
AL

These skills are essential for web developers, system administrators, and DevOps
engineers to deploy and manage web applications with backend databases.

You might also like