Launching an application using XAMPP on EC2 AWS Ubuntu

111 Likes Comment
Letsencrypt XAMPP

If you’re having an only 1Gb RAM , 30 Gb storage VPS on ECS AWS, how will you deploy a website? Here is my suggestion.

  1. Launch an instance using Ubuntu ( not Windows OS , because it needs more than 20 Gbs to complete an Windows Server instance ).
  2. Assign an Elastic Ip for your instance, connect via SSH.
  3. Setup XAMPP for linux on your ubuntu .

+ Stop ubuntu apache process:

/etc/init.d/httpd stop

+ Get xampp installation script:
wget https://www.apachefriends.org/xampp-files/7.0.23/xampp-linux-x64-7.0.23-0-installer.run
sudo chmod +x xampp-linux-x64-7.0.23-0-installer.run
sudo ./xampp-linux-x64-7.0.23-0-installer.run

+ XAMPP / LAMPP commands:
sudo /opt/lampp/lampp start
sudo /opt/lampp/lampp stop
sudo /opt/lampp/lampp restart

Set rules to access phpmyadmin at : /opt/lampp/etc/extra/httpd-xampp.conf
4. Configure virtual hosts
Change the permission for lampp daemon user (default in /opt/lampp/etc/httpd.conf)
chown -R daemon.daemon /opt/lampp/htdocs
Non-SSL:

ServerAdmin [email protected]
DocumentRoot "/opt/lampp/htdocs/nkl.com"
ServerName nkl.com
DirectoryIndex index.php
ErrorLog "logs/dulichclub1-error_log"
CustomLog "logs/dulichclub1-access_log" common

SSL HTTPS on:
+ Install let’s encrypt: using certbot
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-apache

Install ssl cert for a domain
sudo certbot --apache -d mywebsite.com
for multiple domains , sub-domains
sudo certbot --apache -d mywebsite.com -d sub1.mywebsite.com -d sub2.mywebsite.com
full command
certbot certonly --lampp -a webroot --webroot-path=/opt/lampp/htdocs/nkl-domain.com -m [email protected] --agree-tos -d nkl-domain.com

+Virtual host sample configuration

DocumentRoot "/opt/lampp/htdocs/nkl.com"
ServerName nkl.com
ServerAdmin [email protected]
ErrorLog "/opt/lampp/logs/godl-error_log"
TransferLog "/opt/lampp/logs/godl-access_log"
SSLEngine on
SSLCertificateFile "/etc/letsencrypt/live/nkl.com/cert.pem"
SSLCertificateKeyFile "/etc/letsencrypt/live/nkl.com/privkey.pem"
SSLCertificateChainFile "/etc/letsencrypt/live/nkl.com/chain.pem"

5. Test your SSL website url: https://nkl-domain.com

You might like

Avatar

About the Author: Toc Xoan

Leave a Reply

Your email address will not be published. Required fields are marked *