I cannot figure out how to set my next js project to run on HTTPS.
I am using Next 12.3 and deploying on AWS EC2. I have my SSL sertificates and all ports are open. What should I do to run it like that?
P.S.
All the answers that I've found are about running on HTTPS during the development.
Some people even claimed that it is not natively supported by Next. Is this true?
If you setup nginx, this becomes extremely easy.
You can handle the SSL part in nginx and run your NextJS server normally and you will have a server running on HTTPS.
See Configuring HTTPS servers for setting up Nginx.
Related
i'm trying to deploy my simple apollo-server on an Ubuntu 18.04 instance from Amazon Web Services(AWS) EC2. It works fine, but i need/want the traffic to be over HTTPS instead. I was wondering which could be the best option. Im running the code with "forever"("forever start lib/index.js"), also using yarn (to start the project "yarn start"). I'm able to access the server with the ip address () and everything works fine. I would like to do it ASAP, already tried with apollo-server-lambda and others Nodejs hosting websites.
The easier way to do this on AWS is by using a EC2 load balancer. You just need to create an application load balancer and add your instance to the target group. Once you have the load balancer created, you can apply the SSL certificate easily on your load balancer. This approach doesn't require you to change your application code at all.
Please refer this docs.
https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-application-load-balancer.html
If you don't want to use a load balancer, you need to apply the SSL certificate on the application level. Hope this helps.
I'm trying to install the cache server for OpenCPU (I need to enable caching) on an Ubuntu 16.04 EC2 instance. A dependency of opencpu-cache is the latest version of nginx (I can't install the cache server without it).
After I had already installed OpenCPU and verified that it was working, I installed nginx and then opencpu-cache. After installation, however, I can no longer make HTTP or HTTPS requests to the server. Entering both the public IP address and public DNS from the AWS console into my web browser fails to yield a landing page for the server, whereas it was working fine before I installed nginx.
My security rules on AWS are set up correctly (i.e. they're allowing the right ports for HTTP and HTTPS), so what is the issue? All my packages on the server are also up-to-date. SSH sessions work just fine still. I just can't figure out what the issue is.
Nevermind, it turns out that sudo service opencpu-cache restart did the trick lol. Props to Jeroen above.
I have a couple applications (PDG Stores) running on a Plesk server running Apache both of them use a CGI include to run a php script that builds their menus. Upon moving to a new server Plesk12 Odin + Nginx + Apache none of these includes work any longer.
Not sure where to start here, is it Nginx, Apache? or SeLinux?
there are no errors in any logs at all, includes fail silently.
the Apache include module is enabled
Not sure how to troubleshoot for Nginx or SeLinux
Has anyone else had this issue?
I have recently deployed a Beanstalk application on EC2.
This application is deployed using Docker.
I have discovered that every Beanstalk EC2 machine comes with a nginx that acts as a proxy(I don't really understand why, not documented anywhere).
Now the problem is that I do not know which nginx should have its configuration optimized (worker_processes, worker_connections, etc.)
Now, I know what I do not want and that is to configure nginx in two places.
I also tried using passenger as standalone but passenger as standalone looks like nginx.
How do you manage this situation in production ?
why is there a default nginx running on the AWS EC2 AMI in the first place ?
you really configure two nginx ?
is first nginx just a proxy(on the AWS EC2 machine) ?
should not touch anything regarding topmost nginx ?
isn't this first nginx also affected by concurrency and should be optimized ?
I usually run my Flask applications with uWSGI and an nginx in front of it.
But I was thinking that the same could be achieved with just supervisor and nginx, so I googled around and found a lot of posts on how to setup and the benefits of the uWSGI-supervisor-nginx stack. I've decided to turn to SO, risking getting axed online for such a question.
So what are the benefits of running a Flask application behind uWSGI, supervisor and nginx?
Why does apparently no one run Flask applications with only supervisor?
An app server such as gnicorn or uWSGI (used to host the flask applications) is used with nginx. nginx is a reverse proxy server which acts as a middleman. This helps with load balancing - handling multiples requests efficiently by distributing workloads over the resources. On top of this, supervisor is just used to monitor and control the server processes (gunicorn or uWSGI in our example).
From my understanding, the web server that comes with Flask (werkzeug server) is not production ready and should be used for development purposes only.
It's all about performance. Usually servers build into frameworks like Flask or Django are design for development environment, when you can quickly and easily reload code which you changed.
When you are running your application in production environment you don't have to worry about debugging and reloading your code often. Your biggest concerns are performance, security and configuration. During setting up production environment you can choose between uWSGI, Gunicorn , mod_wsgi and many others.
You can find plenty of blog posts with benchmarks between them and choose one which works best for you.