Nginx-Node-AWS-Lightsail configuration

Keywords: Nginx - AWS - How to - Application configuration


I have been trying to get it done last three days, but no luck, so I really need help with the Nginx configuration.
I need to configure two AWS Lightsail servers (basically EC2 ) with Bitnami Nginx images and Node applications, but the problem is I don’t know how. I tried it many times last three days, and now I need to give up and ask here. All the steps ( red from the “internet” ) I manage to get it done and working, but only for the “clean” version of Nginx. I am missing something, that’s for sure.

I have managed to make /opt/bitnami/apps folder with application name as folders and with htdocs and conf folders inside with all the needed files inside. Got this folder structure here from the forum.

On one server, I need to have a way to access all Node applications with /app1, /app2, /app2, etc.

On the second server, I need to have access to Node applications, but as different domains, like,, etc.

Can anyone point me where I can learn how to do that, or does anyone care to explain here?

Thank you!!!

I have managed to do something, :rofl:, and now I have a problem how to proxy node applications so users can access it like /app1, /app2, /app3…

I have made an apps directory with these apps and started them with pm2, but I don’t have a clue how to expose them so they are accessible with the same IP/domain, but different folders.

Tried to make nginx-app.conf in applications conf, but no luck. The steps are a little confusing and I had no luck finding it here on the forum or in bitnami documentation.

Thank you.

Hi @ttarzan,

We do not have a specific guide to deploy a Node.js app on top of the Bitnami NGINX solution (we have it for Apache though However, you can follow this guide to deploy a PHP application but will need to adapt it to configure the NGINX Reverse Proxy in those configuration files

You can get more information about how to configure the Reverse Proxy in the NGINX’s documentation

Let us know if you have any questions

Happy to help!

Was my answer helpful? Click on :heart:

Thanx @jota I will try that today.
The directives from nginx documentation should be entered to the file in /opt/bitnami/apps/myapp/conf file? And if so, what should be the name of that file? nginx-app.conf or nginx-prefix.conf?

I still cannot make this happen. I just don’t understand this, and that’s it.
I’ve done all the steps from the links jota said, but no luck. every other time I’ve some other error, from duplicate location, Cannot GET errors, etc.

can anyone here help me with some dummy steps, or just give up from bitnami Nginx and get a clear version?

thank you

Hi @ttarzan,

No, the configuration needs to be included in the files under the /opt/bitnami/nginx/conf/server_blocks/ folder.

Can you run the Bitnami Diagnostic tool so we can take a look at your configuration and log files?


Hi @jota,
sorry for little delay, but here is the code

I have made many changes to conf files and who knows what, but still didn’t get to resolve the problem. Proxy passes me to the root of the app, but as soon I click on some link, let’s say /admin/sign, Nginx returns 404 or 502.

The goal here is to have access like this /app1, /app2. /app3.

Thank you very much!!!

Hi @ttarzan,

I can see those application use the root path of the ports 3000 and 3001, can you change the apps to use /gkom and /milan so they match the same configuration you want to use in the NGINX’s configuration. You will need to check that the apps work when using ports 3000 and 3001

That probably solves the 404 error messages you are getting.

I have checked them with curl, and they are working locally ( started with pm2 ), but as soon as I try to get them over Nginx, I’ve got 404.

for example, is working locally ( tested with curl ), but when I call it over nginx I just got the first page, and every other link/page is 404 ( /gkom/admin, /gkom/list, etc )

can you tell me, where should i change those root paths?

Hi @ttarzan,

I can see that NGINX is returning errors in its log file due to a typo in the configuration files

2021/09/15 10:55:55 [emerg] 27065#27065: unexpected "}" in /opt/bitnami/apps/gkom/conf/nginx-prefix.conf:4
2021/09/15 10:57:25 [emerg] 27128#27128: unexpected "}" in /opt/bitnami/apps/gkom/conf/nginx-prefix.conf:4

Could you please review the information of the log file (/opt/bitnami/nginx/logs/error.log) and restart the web server for the changes to take effect?