For web hosting of an Enterprise application do we need web server or Application server?
When application server can serve all protocols for client requests and responses why web server is introduced ?
Can application server be running in a web server so that Enterprise application can be accessed in WWW ?
Please help, these are my all time hunting doubts Thank You...
You could let your application server be your webserver as well, but you generally shouldn't.
Two reasons come to mind (maybe there are more):
security: Your application server might have additional ports/service endpoints/interfaces etc. which are accessed locally and you don't want to expose them to the Web. (You could achieve results with a suitable firewall, but the webserver adds another layer of protection).
performance: If there is no dedicated web server, your application server has to serve static content (images, static pages etc.) in addition to performing the business logic. Having dedicated web servers helps in distribute the load.
Related
I am confused as to why when building a node/express application I dont need to use another web server but when working with Java or Spring or a python backend usually a webserver like nginx or apache is used. I am getting confused as to what Apache and nginx do, don't they just handle HTTP requests just like we do in node or express? But then in Spring there are controllers that handle the requests so why do we need to have JBoss or Apache running?
In the old times there was a strict separation between the "application" and the "application server"/"web server". Application servers (like JBoss) provided the configuration of the resources (connections to DB for example), etc. to the application deployed on them. Web servers (like Apache) provided the configuration for possibly multiple web applications hosted on them.
Currently, in the era of self-hosted apps (which means: apps that contains embedded HTTP server) you often don't need a separate webserver. But tools like Nginx are still used for example as load-balancers, etc. Application servers (JBoss, etc.) are not often used nowadays, because of the embedded HTTP servers that you're able to configure without asking Ops-people to do it for you - it's quicker and more convenient.
If you are writing a NodeJS application then you don't "need" another server, except maybe when you are scaling a production ready deployment
The simple answer is that express, Apache, nginx and JBoss are all web server. Since all of these are web servers they each can pretty much do the work of each other. However, each of them have strengths and weaknesses which is why often times they can work together. For example a common practice is to place an express server behind nginx to let nginx handle load balancing, static assets and SSL termination which nginx is very good at but maybe let API and websocket connections fall through to the express server which is what express is typically good at.
A developer may pick Apache if they are working with PHP because the integration is so good but pick JBoss if they are working with Java EE.
I have seen tons of examples and read tons of articles about nodejs express app deployment. Almost always after implementing all logic (including serving static files) in express, the next step is to forget all the claims about how incredibly fast node.js is and how amazing it is in all benchmarks for concurrent requests. After you no longer remember the reasons why you learnt this amazing new technology which changes the world and how we think of web applications, there you go and install good old nginx to act as an entry gate to your express app.
Don't get me wrong, I understand all the features of nginx, having deployed tons of PHP apps with nginx in my days. But simply put, why? Why not let my app be balanced by pm2 e.g., run it on all cores of my VPS and have node.js native clustering support handle the load balancing?
Obviously, I am talking about the case of using a single machine for the app, not deploying it to multiple VPSs. Then a load balancer of some sort again does make some sense.
Thank you anybody who can explain the reasons for using a web server to forward traffic to another webserver.
You can use nginx server to serve static content of your application instead of nodejs.
As nginx is better at serving static content like html, css, js & image files than nodejs.
And another thing is in case of crashing of any node service, you can show proper error pages using nginx.
I have an api used by my angular application developed in asp.net core 2.0
Its been deployed in IIS and configured to use kestrel.
I read Kestrel is not safe when exposing the application publicly and more.
Is that true? Is kestrel still not ready for production use? or kestrel is for different purpose altogether like few blogs say for internal applications.
Yes, Kestrel is production ready and is supported on all platforms and versions that .NET Core supports, but if your application is available on public networks Microsoft recommend that you use it with a reverse proxy:
Even if a reverse proxy server isn't required, using a reverse proxy server might be a good choice.
You can find out more about the options for hosting ASP.NET Core apps in the MSDN documentation, including on Windows with IIS, on Linux with Nginx and on Linux with Apache among others.
There are a number of reasons to use a reverse proxy including:
Running multiple applications on the same IP and port
Limiting your exposed surface area
Additional layers of configuration and defence
Simplified load balancing and SSL set-up (these can be terminated at the reverse proxy for example)
Better support for static files, compression, etc.
Depending on your requirements, different aspects of the above may be more or less important for you.
For example, Kestrel is very lightweight web server that specialises in running ASP.NET Core apps, but to do that it doesn't have many of the features of the likes of IIS or Apache, which you may find that you want. For example, processing static file such as images, CSS or JS doesn't need to be handled by the ASP.NET Core engine - using IIS you can automatically compress these files and add caching headers to speed up subsequent page loads. Similarly redirects and routing can be handled by IIS before the request reaches the processor.
From a security point of view, again you can take advantage of features such as request filtering (i.e. verbs used, paths, etc.), IP filtering, authentication, etc. before the request reaches Kestrel and not have to handle those aspects in your code.
As a point of note, for ASP.NET Core 1.x, the documentation is even more specific:
If you expose your application to the Internet, you must use IIS, Nginx, or Apache as a reverse proxy server. A reverse proxy server receives HTTP requests from the Internet and forwards them to Kestrel after some preliminary handling.
I would like to write a web app where response time is critical.
I am a bit lost with servers and web frameworks benchmarks. I see that some web frameworks offer a web server but are also sometime used with other servers like apache.
I guess that my logic should be in C++ on the server side but I have no idea what server/web framework combination to choose to query and serve the results as web pages as fast as possible.
When creating a site you have the option on the sub folders with in to convert them to an application. Why and when would you ever need to do this and what are the advantages and disadvantages? And what is the difference now that it is an application?
Why and when would you ever need to use an application
When you want to make your websites more robust.
What are the advantages of an application?
You can isolate a website when it's an application - the site has its own Session state and Application state, it is in effect a new standalone application. When the website has a problem it won't impact other websites on the server. The following description might help:
An application belongs to an application pool, which isolates the
application from applications in other application pools on the
server.
This link is really helpful and discusses applications and virtual directories in IIS.