Ubuntu 18.04 SSL configuration on AWS

Forum home -> Tech Talk -> View topic

Post

Posted
Rating:
#540 (In Topic #110)
Avatar
Nerd Club Member
HELLO  :)

I am new to the NOT but have been around a while. My web application will load on AWS. High level diagram is below.

My Challenge: at this point I need to work out the apache configuration on the  AWS Ubuntu 18.04 ec2 instance.
I need the apache server to listen on 8080 and install a new certificate on the server.
I need step instructions for the apache configuation details below.



ubuntu_aws_ec2_backend_middleware.png

The dynamic application is hosted in the var/www directory.
The static build files are loaded to an S3 bucket.
The satic files connect to the backend middleware over port 8080.
There is a load balancer that requires a cert to connect to the ec2 targets
The load balncer also requies a hreartbeat from the server to connect.
So the server also needs an SSL cert and to listen on 8080

Below is the server virtual host file:

<VirtualHost *:80>
        ServerAdmin info@the_company.com
        ServerName n-lite.net
        ServerAlias www.n-lite.net
        SSLEngine on
        SSLCertificateFile /etc/certs/certificate.pem
        SSLCertificateKeyFile /etc/certs/privatekey.pem
        SSLCertificateChainFile /etc/certs/chain.pem

   ProxyRequests Off
   ProxyPreserveHost On
   ProxyVia Full
   <Proxy *>
      Require all granted
   </Proxy>

   <Location /nodejs>
      ProxyPass .16.83.124:8080
      ProxyPassReverse .16.83.124:8080
   </Location>

    <Directory "/var/www/n-lite.net/backend”>
      AllowOverride All
    </Directory>
</VirtualHost>


The apache Ports.conf file contains:

Listen 80

<IfModule ssl_module>
        Listen 8080
</IfModule>

<IfModule mod_gnutls.c>
        Listen 8080
</IfModule>


The ubuntu server firewall will be locked down to allow 8080  traffic.


The application front door DNS is on Cloudflare
URL is https://www.n-lite.net
When you try to register a new user the server sends a 500 error message.
Curl the front door returns 200 success.
Curl the server instance directly returns an error.

 
Online now: No Back to the top

Post

Posted
Rating:
#541
Avatar
Nerd Club Member
Status update - Updated the ports.conf to 8080 and now getting a so moving to the contheartbeat on the Load balancer .
Still receiving a 500 error on registration virtual host file.
Online now: No Back to the top

Post

Posted
Rating:
#542
Avatar
Nerd Club Member
Whops - cant run apache and node on the same port.
So falling back to an adjustment on the load balancer.
Set the LB to 443 pointing to the ec2.
Ec2 Listing on 443 =>  proxy redirect to 8080. for Node app.Now I have a healthy status check and
path to the server.

server curl now states:

  ~ curl -IvkL n-lite.net:8080                   
*   Trying 104.27.185.227…
* TCP_NODELAY set
* Connected to n-lite.net (104.27.185.227) port 8080 (#0)
> HEAD / HTTP/1.1
> Host: n-lite.net:8080
> User-Agent: curl/7.64.1
> Accept: **
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 256)!
< HTTP/2 200
HTTP/2 200
< date: Wed, 16 Sep 2020 20:42:27 GMT
date: Wed, 16 Sep 2020 20:42:27 GMT
< content-type: text/html
content-type: text/html
< set-cookie: __cfduid=dba6e2a599967c46183d6aeaf55bcb02e1600288946; expires=Fri, 16-Oct-20 20:42:26 GMT; path=/; domain=.n-lite.net; HttpOnly; SameSite=Lax; Secure
set-cookie: __cfduid=dba6e2a599967c46183d6aeaf55bcb02e1600288946; expires=Fri, 16-Oct-20 20:42:26 GMT; path=/; domain=.n-lite.net; HttpOnly; SameSite=Lax; Secure
< last-modified: Thu, 10 Sep 2020 17:38:22 GMT
last-modified: Thu, 10 Sep 2020 17:38:22 GMT
< vary: Accept-Encoding
vary: Accept-Encoding
< x-cache: Hit from cloudfront
x-cache: Hit from cloudfront
< via: 1.1 f9d716a351f14a0ac1fac2449734849b.cloudfront.net (CloudFront)
via: 1.1 f9d716a351f14a0ac1fac2449734849b.cloudfront.net (CloudFront)
< x-amz-cf-pop: SEA19-C2
x-amz-cf-pop: SEA19-C2
< x-amz-cf-id: HkMcqz_l_aCuFPsU7Sdx49beXl4FwHzTcwdPwW3G_PiJE9i2xC_2WQ==
x-amz-cf-id: HkMcqz_l_aCuFPsU7Sdx49beXl4FwHzTcwdPwW3G_PiJE9i2xC_2WQ==
< age: 37324
age: 37324
< cf-cache-status: DYNAMIC
cf-cache-status: DYNAMIC
< cf-request-id: 053a409282000024a092bb5200000001
cf-request-id: 053a409282000024a092bb5200000001
< expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
< server: cloudflare
server: cloudflare
< cf-ray: 5d3d69fd98f024a0-IAD
cf-ray: 5d3d69fd98f024a0-IAD

<
* Connection #1 to host n-lite.net left intact
* Closing connection 0
* Closing connection 1


GOOD PROGRESS  :ninja:
 
unfortunately something is still missing in the configuration:

The application still gets a 500 error message.

Online now: No Back to the top

Post

Posted
Rating:
#544
Avatar
Nerd Club Member
ITS a CORS policy issue.  S3 dosent support dynamic hosting.  so I need to move to a frontend instance server.
Online now: No Back to the top
1 guest and 0 members have just viewed this.