Portfolio web application implementing the LAMP stack architecture (Linux, Apache2, Mysql, PHP). Deployed on AWS EC2. The project showcases a minimalist, fundamentals view of the MVC pattern.
salvador-diaz-lamp
βββ README.md
βββ composer.json
βββ composer.lock
βββ env.php # Sensitive variables.
βββ env.php.example # Overview of sensitive variables.
βββ index.php # Entry point to the entire application.
βββ .htaccess # Web server rules applied at runtime.
βββ src # Source code folder.
βββ Router.php # Establishes the available routes and request methods.
βββ View.php # Estbalishes rendering logic.
βββ controllers # Gets request from router, applies business logic and optionally renders a view.
β βββ ...
βββ db.php # Establishes the database connection.
βββ models # Interaction with the database tables.
β βββ ...
βββ services # Apply repetitive business logic not specific to a controller.
β βββ ...
βββ storage # Holds files and images.
β βββ ...
βββ utils # Apply generic and repetitive logic (eg: date formatting).
βββ vendor # Hold dependencie's source code.
β βββ ...
βββ views # Rendering content.
βββ assets # CSS and JS files.
β βββ ...
βββ components # Reusable portions of content for views (eg: the navbar).
β βββ ...
βββ ...
Current deployment consists of an EC2 Ubuntu instance located on the sa-east-1
region.
Ports 22, 80, and 443 are open.
General overview for a fresh instance deploy. Restricted. Not all deployment steps are listed (eg: certificate issuing with certbot).
sudo apt update # update server binaries
sudo apt install apache2 -y # install web server
sudo a2enmod headers # enable RequestHeader directives module
sudo a2enmod ssl # enable ssl directives module
sudo a2enmod rewrite # enable rewrite directives module
# define `DocumentRoot /var/www/salvador-diaz-lamp` in /etc/apache2/sites-available/000-default.conf
# also define `AllowOverride All` to enable .htaccess files
sudo service apache2 restart
cd /var/www
sudo git clone https://github.com/salvador-diaz/salvador-diaz-lamp
cd salvador-diaz-lamp
cp env.php.example env.php # on later steps, fill database an Gooogle API env variables
sudo apt intall php -y
sudo apt install php-pdo php-mysql -y # database connector module
sudo apt install certbot -y # SSL certificate issuing
sudo apt install mysql-server -y # on later steps, pass a database dump with the tables
sudo mysql -e "ALTER USER '<DB_USER>'@'<DB_USER>' IDENTIFIED WITH mysql_native_password BY '<DB_PASS>';" # db access for the app
sudo apt install composer -y # project dependency manager. For latest see: https://getcomposer.org/download/
sudo composer install # install project dependencies
yes