Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mstdmstd's avatar

How to set https for laravel app under ASW ec2 instance ?

Hallo, I installed ASW ec2 instance(Ubuntu 20) with apache 2 and after apache config changes root of my laravel 8/vuejs app run at http://ec2-NN-NN-NN-NN.eu-central-1.compute.amazonaws.com/ As my app use OAuth client ID I tried and failed to make OAuth client ID for my ASW ec2 instance : https://imgur.com/a/tIQiPAe Could you please advice some simple way to run my app under https ?

This site is under dev now and I would not like to install https at this stage, but looks like I need to generate OAuth client ID...

Thanks!

0 likes
2 replies
fideloper's avatar
Level 11

Hi!

Based on your question, some of the following may be new territory for you, but hopefully not too crazy! Here's an outline of what to do:

1. Give the server an IP address that doesn't change

  1. Create an Elastic IP address (EIP) within the ec2 control panel
    • note: These aren't free, but they are relatively cheap
  2. Associate that EIP with your running instance
    • This ensures your server has a static IP address that won't change

2. Create a hostname for your server

Buy or use a domain. For example, if you own example.org, you can set that domain to point to your server via its DNS settings.

3. Setup SSL

The "free" way to setup SSL will be to use lets encrypt - here's a good post on how to get that running with Apache: https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-20-04

1 like
mstdmstd's avatar

Thanks!

  1. I Created “Allocate new address” with option “ Amazon pool” on. I got message : New address request succeeded Elastic IP NN.NNN.NNN.NN

  2. In the listing of “Addresses > Associate address” I selected newly create Associate address and applied Instance I created before. I left options “Private IP” empty and “Reassociation” non checked I am not sure is it correct? Applying OI got message “Associate address request succeeded”

  3. I can open my site by url http://NN.NNN.NNN.NN/, but I failed to run safe connection by url https://NN.NNN.NNN.NN/

  4. I am not sure what do you mean by “This ensures your server has a static IP address that won't change” point Could you please detalize which checks have I to do?

  5. Could you please advice where buy a domain for hostname ? I used https://my.freenom.com for creating hostnames for my applications on Digital Ocean. Is it good choice ?

  6. Now I make “dev” server, so is it possible to create ssl support without hostname defined for my site? In other words can I apply your referenced article “How To Secure Apache with Let's Encrypt on Ubuntu 20.04” to my site url http://NN.NNN.NNN.NN/ ?

Please or to participate in this conversation.