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

Web Service Including Database On AWS

The document discusses setting up a web server on AWS including installing and configuring Apache, Nginx, PHP and databases like MySQL or PostgreSQL. It provides steps to install LAMP or LEMP stacks on Linux as well as configure the individual components and their connections.

Uploaded by

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

Web Service Including Database On AWS

The document discusses setting up a web server on AWS including installing and configuring Apache, Nginx, PHP and databases like MySQL or PostgreSQL. It provides steps to install LAMP or LEMP stacks on Linux as well as configure the individual components and their connections.

Uploaded by

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

LAB web service on AWS

Web service (apache, nginx) including database

A web server is software and hardware that uses HTTP (Hypertext Transfer
Protocol) and other protocols to respond to client requests made over the World
Wide Web. The main job of a web server is to display website content through
storing, processing and delivering webpages to users. Besides HTTP, web servers
also support SMTP (Simple Mail Transfer Protocol) and FTP (File Transfer
Protocol), used for email, file transfer and storage.

Commonly used for web server is nginx for linux, apache for linux and window in
linux, Microsoft Internet Information Services (IIS) for window, and Sun Java
System Web Server for linux and window.

Front end website such as html, CSS, java script, don’t need any database to
install in operating system.
Back and front end website such as PHP, Java, we do need to install database to
store data.

Relational datbase such as mysql, postgre, sql server, oracle, maridb, mongo db,
it is stroed databse based on table (row, column)
Object oreinted database : use object or file to store data suchs as XML, Json…

Run PHP website in linux server

Page 1 of 7
We have 2 options to run back end website such as php or java in linux server we
can install LAMP (php, apache, mysql) server on Linux or we can install mannuly
on linux server such as nginx, mysql, php.

1-install mysql database on linux server

Install and update mysql

# apt update && apt install mysql-server

Check mysql service

#service mysql status

Login to mysql

#mysql

Create username

#create user 'myadmin'@'%' identified by 'Admin@12345'; => for accessing from


other pc

Grant user to read database

Page 2 of 7
#GRANT ALL ON *.* TO myadmin@'%' with grant option;

Show users

# SELECT User FROM mysql.user;

Allow remote access to db from linux

#vi /etc/mysql/mysql.conf.d/mysqld.cnf

bind-address = 0.0.0.0 (in security perspective should allow only ip of


system admin)
mysqlx-bind-address = 0.0.0.0 (in security perspective should allow only ip of
system admin)

Restart mysql

#root@ubuntu:/etc/mysql/mysql.conf.d# systemctl restart mysql

Note : if it is unable to connect please turn off your firewall.


# ufw disable

Import database

Page 3 of 7
Page 4 of 7
2-Install php

apt install php8.1-fpm php8.1 php8.1-common php8.1-mysql php8.1-xml


php8.1-xmlrpc php8.1-curl php8.1-gd php8.1-imagick php8.1-cli php8.1-imap
php8.1-mbstring php8.1-opcache php8.1-soap php8.1-zip php8.1-intl php8.1-bcmath
unzip –y

or
apt install php7.4-cli

Copy file by using Winscp

/var/www/web2/

Configure nginx
Vi /etc/nginx/sites-available/default

Page 5 of 7
Configure connection between php and mysql database
Vi /var/www/web2/config.php

Page 6 of 7
Testing web service with php website

Page 7 of 7

You might also like