mod_ssl does not seem to be enabled ElasticBeanStalk - amazon-web-services

I deployed a web app built with Laravel on Amazon's ElasticBeanStalk, after setup, I tried accessing the page but I got HTTP 408 error. I setup the loadbalancer to listen on port 80 and 443, and also there is a certificate attached to port 443.
I accessed the log for and found this mod_ssl does not seem to be enabled, I have tried searching for solutions but I am yet to get anything similar.
Any help will do. Thanks

As far as enabling mod_ssl goes, you'll have to download the module and load it as it doesn't come preinstalled on Amazon Linux. I add mod24_ssl in a config file under .ebextensions:
packages:
yum:
mod24_ssl: []
This should install mod_ssl.so under /etc/httpd/modules/, and IIRC there should be an existing file /etc/httpd/conf.modules.d/00-ssl.conf that will run LoadModule ssl_module modules/mod_ssl.so
Not sure if mod_ssl is the root cause of your issue, but this will load mod_ssl at least. I actually had different issues with HTTP 408s before (not from production traffic, but apparently from unused connections the load balancer keeps open) and it resolved itself by updating the Apache server based on advice from here https://forums.aws.amazon.com/thread.jspa?messageID=307846

Related

Plausible analytics on a server with a webapp

I have Django hosted with Nginx on DigitalOcean. Now I want to install Plausible Analytics. How do I do this? How do I change the Nginx config to get to the Plausible dashboard with mydomain/plausible for example?
Setup plausible by either running the software directly or in a docker container - let's say it runs on port 8080
Then in your nginx.conf - you should have a server block for your domain
Within that add a location block with the path you want plausible on and add a proxy pass directive to forward the requests to localhost:8080
Monitor access.log and error.log to debug any issues that may happen

Nginx Proxy Manager and django with nginx

I have a stack Django+Gunicorn+nginx running in docker containers. It is accessible from outside by domain and Port, like web.example.com:1300 . Also, there is Nginx Proxy Manager (NPM) running (uses ports 80 and 443) and succesfully managing some other resources (for example nextcloud). But it doesn't proxy to my django project at port 1300, shows "502 Bad Gateway".
In the Proxy Hosts of NPM I've added config:
domain names: web.example.com
Forward Hostname / IP: nginx_docker_container_name (this way it works with other resources)
Forward Port: 1300
Other settings: tried multiple combinations without success (like with and without SSL certificates etc.)
Is it possible to proxy using NPM?
Sorry if I missed to write some information, actually I do not know what else to state.
I managed to solve the problem myself.
So, nginx in docker container serves web-site with static pages. Nginx proxy manager proxying htpp protocol to nginx and secures communication (and also works from docker container in my set-up).
My mistake was that I didn't connect those docker containers by virtual network.
Ones I put them into one network - everything works.
Then I unpublished nginx port (1300).
NPM proxy settings are "standard", e.g. no "custom location" and nothing in "Advanced" tab. Just "Forward Hostname / IP" is docker container tag and "Forward Port" is nginx port it listens to (80 by default).
With WhiteNoise , you don't need to configure nginx for django static files
❤️❤️❤️

NGINX Docker on Server with pre-existing NGINX on Ubuntu Server

I am currently running into an issue with one of my projects that will be running in Docker on my Ubuntu Server with a NGINX docker container to manage the reverse proxy for the Django Project. My issue I am running into is I already have previous Django projects running on that particular Ubuntu server so port 80 is already being used by a NGINX block running on the actual server.
Is there a workaround to running my Docker NGINX as well as the Ubuntu NGINX and have my docker image run as a "add on" site because the Django sites hosted there are clients websites, so I would prefer to not interfere with them if I dont have to.
My project needs HTTPS because it is serving data to a React-Native app running on Android APK 28 which for some reason has a security rule that blocks non HTTPS connections from happening in the app. If anyone else has run into an issue like this I would gladly appreciate the advice on how to tackle this issue.
I have tried running NGINX in Docker with port 81 instead of port 80 and that works perfectly, but I dont think there is a way to make a secure connection to port 81 is there?
Thanks in advance.
You can't just mess with default HTTP ports for endpoints - user browsers use 80 and 443 by default. If you change those, your users would have to connect to your.server.com:81 or something similar. Nobody would do that for a public server, but this can be an option for a private one.
I think a reasonable way out of this will be to use host's NGINX to proxy requests into Docker's NGINX (if there is sense in keeping it at all). You can handle HTTPS termination on host's NGINX and pass plain HTTP into Docker's one.
Another adequate option is to use another server, so that everything works with no dirty hacking involved.

access django website hosted on home server from external IP - CONNECTION TIMEOUT

I am working on a django project which I was able to access from an external network. But this has recently stopped working. I have tried troubleshooting the problem but I can't seem to figure out the issue.
Below are the steps I followed:
Public IP: 86.40.54.24
Private IP: 192.168.1.18
OS: Ubuntu 20.04
Router: EIR Network default router. Allows the required changes to forward requests
add routing rule in the router
Allow connections from any IP on port 80 to 192.168.1.18 on port 12987
setup rules in ufw to allow connections
ufw allow proto tcp from any to 192.168.1.18 port 12987
settings.py file
ALLOWED_HOSTS ["*"]
run django development server
python3 manage.py runserver 0.0.0.0:12987
Note:
An approach (similar to above) had worked for me and I was able to access my website from an external IP. But it suddenly stopped working. I have not been able to identify the problem.
I have kept the restrictions to bare minimum to be able to get this working once again. I will harden the server after the issue is identified and fixed.

404 Error - AWS EC2

When I try to open my instance via the Public DNS, I get a 404 error.
However, in my security group, I have HTTP/HTTPS/SSH configured to allow all incoming requests. When I connect to the instance via SSH, I can see all of my files there from my repo.
I am running on an Ubuntu 64-bit server with Nginx and Gunicorn.
Any help would be appreciated.
Thank you in advance!
Two possibilities for getting 404 file not found error
Make sure /usr/share/nginx/html/index.html is found or not.
check with nginx.conf file, if it is directing to index.html or not.