Deploy multiple projects on AWS

  1. Launch a AWS EC2 instance, the testing instance is Amazon Linux 2 AMI (HVM), SSD Volume Type - ami-0d7ed3ddb85b521a6

  2. Connect to your EC2 instance, and enter
    sudo vim /etc/httpd/conf.d/yourProjectName.conf

  3. paste the following code

<VirtualHost *:443>
# port 443 for https
ServerName letussleep.space
# Your domin name
DocumentRoot "/var/www/html/yourLaravelProjectName/public"
# The absolute address of your project on EC2
SSLEngine on
SSLCertificateFile /whateverLocationYouWant/certificate.crt
SSLCertificateKeyFile /whateverLocationYouWant/private.key
SSLCertificateChainFile /whateverLocationYouWant/ca_bundle.crt
# They are for SSL signing purpose, corresponding to those validation files you get from SSL signing service.
</VirtualHost>

<VirtualHost *:80>
# port 80 is for http
ServerName letussleep.space
DocumentRoot "/var/www/html/yourLaravelProjectName/public"
redirect / Https://letussleep.space
# When user connect this project via http, redirect to https
</VirtualHost>

<VirtualHost *:80>
ServerName oldletussleep.space
# So, basically in a conf file, we could complete multiple project deployment once we set the domain name properly.
DocumentRoot "/var/www/html/yourProjectName/public"

</VirtualHost>

  1. Although we could complete multiple project deployment in a single config file once we set the domain name and project address properly, I personally prefer one config file to one project to prevent any possible confusion in the future.
  2. So simply repeat all the steps mentioned above, creating a new config file, and config it properly, and then type sudo service httpd restart
  3. Connect to your domain, it should work now.
How to configure Git? What is in git log?

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×