- Setup the git configuration variables
git config --global user.name "Pritpal Singh" git config --global user.email "[email protected]" git config --global core.excludesfile "~/.gitignore" git config --global color.ui true git config --global push.default current sudo ln -s /bin/nano /usr/bin/nano
- Add the git aliases by running this command
curl https://gist.githubusercontent.com/pritdeveloper/703cb04659cd37d836fadbe0f02b0df6/raw >> ~/.gitconfig
- Copy the
.gitignore
file by running the commandcurl https://gist.githubusercontent.com/pritdeveloper/acfd4edd5cc3f43cb6b5f3338acd9fdf/raw > ~/.gitignore
- Install php7.2 by running these commands
sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install libapache2-mod-php7.2 -y sudo a2dismod php7.0 sudo a2enmod php7.2 sudo apt-get install php7.2-dom php7.2-mbstring php7.2-zip php7.2-mysql php7.2-sqlite php7.2-curl php7.2-gd -y sudo service apache2 restart
- Install VIM Editor
sudo apt-get install vim -y
- Open terminal and run this command:
sudo vi /etc/apache2/envvars
- Make the apache run user and group as
ubuntu
by changing these lines:export APACHE_RUN_USER=user export APACHE_RUN_GROUP=user
- Edit the
~/.basrc
file by running this command and make the PS1 command:sudo vi ~/.bashrc
- add the cd to project path
cd /projects/project
- Create the
.bash_aliases
file with this commandcurl https://gist.githubusercontent.com/pritdeveloper/2c67911b93387b307af7ce05adb12a6b/raw > ~/.bash_aliases
- reload the terminal by running this command:
. ~/.bashrc
- Make the
000-default.conf
file by running command:curl https://gist.githubusercontent.com/pritdeveloper/9491d9cf44d433fe8bbc4eb33781cc8a/raw | sudo tee /etc/apache2/sites-enabled/000-default.conf
- Restart the apache server by running:
sudo service apache2 restart
- To reset the mysql root password, follow this link.
- To install phpmyadmin, simply run this command
sudo apt install phpmyadmin -y
- There is a Warning in phpmyadmin which can be fixed by editing file by running this command
sudo vi /usr/share/phpmyadmin/libraries/sql.lib.php
- goto line: 613
- replace the line with
|| (count($analyzed_sql_results['select_expr']) == 1
- Click on the
Manage EC2 Instance
link in the top right of Cloud9 IDE and on the next screen click on the security group under theDescription
tab - Now click on the
Inbound
tab and click onEdit
button. - Add new rules and set the
Type
to HTTP and HTTPS and clickSave
There is a new tutorial for this https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-18-04
- Installing Certbot
sudo add-apt-repository ppa:certbot/certbot sudo apt install python-certbot-apache -y
- Obtaining an SSL Certificate
sudo certbot --apache -d example.com -d www.example.com
- Verifying Certbot Auto-Renewal
sudo certbot renew --dry-run
- Install the
openssl
package by runningsudo apt-get install openssl sudo a2enmod ssl sudo service apache2 restart
- Add directory to store certificate files
sudo mkdir /etc/apache2/ssl
Make sure you have added a domain with
A
record pointing to theIPv4 Public IP
of the instance after associating theElastic IP
with the instance.
- Get a free ssl certificate on sslforfree.com and follow the instructions to download the
sslforfree.zip
file on a location on your computer. - Upload the
sslforfree.zip
file from your computer in theAWS IDE
on the root of the workspace. - Copy and extract the zip file on the
ssl
directory by running this command:sudo cp /home/ubuntu/environment/sslforfree.zip /etc/apache2/ssl/sslforfree.zip sudo unzip /etc/apache2/ssl/sslforfree.zip sudo rm /home/ubuntu/environment/sslforfree.zip /etc/apache2/ssl/sslforfree.zip
- Now you can open the website on
https
without any issues.
Keep in mind that the
sslforfree.com
provides ssl certificate for 3 months and you have to update the certificate in order to use it for longer.