-
Hi, I use to build my projects on top of express.js and nginx. But after discovering this project and seeing that supports compression and SSL not sure if make sense to use nginx anymore. Is ok if I go only with uWebSockets.js or I can lose some features nginx have that uWs.js doesn't? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
I can't answer what you should or shouldn't do. It's up to you. |
Beta Was this translation helpful? Give feedback.
-
I am not sure about the performance difference - might be interesting to investigate. However, one important thing is the use of nginx as a reverse proxy for urls with different domains/servernames but resolving to the same IP address. Basically you want nodejs to serve 1 application - uWS makes it faster - but you want nginx to serve multiple applications from a single point of access. |
Beta Was this translation helpful? Give feedback.
-
It's correct that you don't need Nginx at all. You don't lose any functionality (there isn't anything special that Nginx does that uWS doesn't). I also migrated from using Nginx+Express to just uWS about a year ago, managing many servers at once. It works flawlessly, only challenge I had in my case was to make uWS handle SSL for multiple domains + wildcards through a single router, but it worked well at the end and was worth it. I use a single uWS server to manage all my web applications, which makes this easier, and for cases where I needed a separate server I made a simple proxy function built into my uWS router. Removing Nginx can make your setup simpler, less bloated and also faster by a small bit. Performance-wise you will most likely see a small improvement since a proxy is just an extra step. The difference won't be significant but it'l be there, so unless you need Nginx for other things, I'd say go for it. I also just realized that this question is over 5 years old. |
Beta Was this translation helpful? Give feedback.
-
Over these 5 years, there is only one reason why Nginx is needed, it is HTTP 2 and HTTP 3, uWS works only on HTTP 1.1, this means that all your requests in 1 connection are executed sequentially, without multiplexing, this is important for performance. |
Beta Was this translation helpful? Give feedback.
I can't answer what you should or shouldn't do. It's up to you.