nginx http-proxy infront of PHP-App running on Beanstalk - amazon-web-services

i am very new to AWS and Beanstalk so maybe my question is very easy...
I want to put up a Drupal-Page (with boost) on Beanstalk as PHP-App (PHP + Apache).
And i would like to use nginx as a reserve proxy infront of it. My simple question:
How to do this? And is it a good idea?
I searched the internet and all the tutorials i found were assuming that i run the server. But i couldnt figure out how to use an nginx http-proxy infront of PHP-App running on Beanstalk... unfortunatly.

You can set-up a 2-tier infra within Elastic Beanstalk and then perhaps with an ELB in front
ELB->Nginx->Drupal
However, for the added cost of that instance, not many people run this set-up. At least not within a small set-up that Beanstalk is likely running.

Related

How to run symfony on aws ecs with loadbalancer

im new to aws services and some things are not really clear.
On my local machine i have to services in my docker-compose.yaml (php - symfony6 ,database - mysql), all dependencies are loaded and installed through Dockerfile. To start the application i have a entrypoint.sh with command symfony server:start.
OK, thats fine for local.
Now, i have exactly this configuration to run up to 16 containers in aws ecs behind a loadbalancer, but im sure that isnt the correct way to run this because i cant configure, increase php settings and so i believe its the worst way when i look at the performance.
Do i need a separately nginx for every container?
Is there any option in the loadbalancer settings to run a webserver from there?
Any idea is welcome.
(i think my config files are not interesting for now. If it is, tell me, then i can update and share)
Do i need a separately nginx for every container?
Yes, that is the standard way to run this sort of thing, using two containers (nginx and php). Also, your MySQL server should not be deployed in the same ECS task. Ideally you would be running MySQL in RDS instead of ECS.
Is there any option in the loadbalancer settings to run a webserver from there?
No, a load balancer is just a load balancer. A load balancer is not a web server.

How to edit the nginx configuration of an elastic beanstalk application

I need to change the parameter "worker_connections". because I am getting this error while testing the application with JMeter: 1024 worker_connections are not enough and as stated on many similar questions the solution would be to increase this parameter Node.js Elastic Beanstalk refuses connections under heavy load (ECONNRESET)
The problem is that they do not go to deep into how to change it, Do I need to connect to something specific from a commands console and if so how to do it? I am stuck here, by the way my application is a SpringBoot app deployed on a AWS elastic beanstalk.

Replace the default proxy on AWS Elastic Beanstalk (Linux 2/Node.js) with lua-resty-auto-ssl for multi-tenant SSL

I would like to use lua-resty-auto-ssl as the default reverse proxy on Amazon Linux 2 instances managed by Elastic Beanstalk. I am hoping to terminate SSL for 100s of unique domains on this.
I have successfully used it on a separate EC2 instance, but when I try to use that as an AMI image for launching elastic beanstalk (using a network load balancer to forward 80/443) it does work but shows a red Degraded symbol, I think this is to do with platform hooks or competing nginx configs.
I wondered if there is a way to do it by extending the default platform rather than using an AMI. Or just a way to fix the health reporting of the AMI method.
Has anyone done anything like this? Or have any advice.
Thanks!

Elastic Beanstalk URL cannot access Website after successful environment update

I am hosting a Django site on Elastic Beanstalk. I haven't yet linked it to a custom domain and used to access it through the Beanstalk environment domain name like this: http://mysite-dev.eu-central-1.elasticbeanstalk.com/
Today I did some stress tests on the site which led it to spin up several new EC2 instances. Shortly afterwards I deployed a new version to the beanstalk environment via my local command line while 3 instances were still running in parallel. The update failed due to timeout. Once the environment had terminated all but one instance I tried the deployment again. This time it worked. But since then I cannot access the site through the EB environment domain name anymore. I alway get a "took too long to respond" error.
I can access it through my ec2 instance's IP address as well as through my load balancer's DNS. The beanstalk environment is healthy and the logs are not showing any errors. The beanstalk environment's domain is also part of my allowed hosts setting in Django. So my first assumption was that there is something wrong in the security group settings.
Since the load balancer is getting through it seems that the issue is with the Beanstalk environment's domain. As I understand the beanstalk domain name points to the load balancer which then redirects to the instances? So could it be that the environment update in combination with new instances spinning up has somehow corrupted the connection? If yes, how do I fix this and if no what else could be the cause?
Being a developer and newbie to cloud hosting my understanding is fairly limited in this respect. My issue seems to be similar to this one Elastic Beanstalk URL root not working - EC2 Elastic IP and Elastic IP Public DNS working
, but hasn't helped me further
Many Thanks!
Update: After one day everything is back to normal. The environment URL works as previously as if the dependencies had recovered overnight.
Obviously a server can experience downtime, but since the site worked fine when accessing the ec2 instance ip and the load balancer dns directly, I am still a bit puzzled about what's going on here.
If anyone has an explanantion for this behaviour, I'd love to hear it.
Otherwise, for those experiencing similar issues after a botched update: Before tearing out your hair in desperation, try just leaving the patient alone overnight and let the AWS ecosystem work its magic.

Multiple dockers and multiple domains on elastic beanstalk

I have 10 low-traffic websites, all with different domains and I want to run all of them on one elastic beanstalk environment.
I'm a developer with zero experience with docker but from reading other answers I got the idea that a multicontainer docker environment could be what I need.
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_ecs.html
Can someone who have done it before (multiple domains on an EB environment) confirm that I'm on the right direction? If so, is there somewhere a tutorial on doing a multi-domain environment for people who never used docker?
AWS EB doesn't handle routing based on domain names. You can expose multiple ports. 80 and 9000 are exposed in the graphic below. But the visitor must type to port into the url, that's very ugly.
In order to route traffic to a container based on the domain you need a proxy. Nginx Proxy can do that for you.