Last reviewed by Netlify Support: February 2022
We often get questions about how to run a specific backend server or database at Netlify. Examples of these types of questions include:
- How to I get my node HTTP listener to respond to requests?
- How do I start Mongo/MySQL/<insert-some-database-here> running on the server?
- How can I SSH into my website?
We are here today to answer these questions - and the answer is: you can’t!
This often comes as a bit of a surprise and there is a good reason for this which this topic hopes to explain.
Netlify is specifically designed for “the Jamstack”: https://jamstack.org/
The Jamstack is not about specific technologies. It’s a new way of building websites and apps that delivers better performance, higher security, lower cost of scaling, and a better developer experience.
A core principle of the Jamstack is that it doesn’t depend on a “web server”. Now, clearly there is still a web server replying to HTTP requests, but the CDN at Netlify only serves static files. What isn’t happening is that a web application, in realtime as the HTTP request is received, dynamically generates a unique version of a web page on the fly using a programming language of some kind. With a Jamstack site, there is no application server or language runtime (meaning no node.js, Ruby, PHP, Python, etc).
If I cannot run a web server, why are you installing node modules (or a specific Ruby version) when I deploy my site?
You can use these languages (Node, Ruby, Python, PHP and many others) to build the site, but you can not use the language on the web server after the site is deployed.
This is where the A in Jamstack comes in (A = API). Any runtime/dynamic information the page needs is collected using API calls which originate from the end user’s web browser - not the web server.
Netlify’s Functions are one way to make your own short-running API endpoints and easily deploy and access via your site at Netlify. You can also access backend services (such as API’s, databases, etc) that are running on other providers. (So, using serverless.com or Heroku for an API endpoint instead of Functions will work too!) Using third-party API’s (like Stripe) is a common practice as well.
If your backend service is hosted with another provider, Netlify can also proxy these API requests. Proxying API calls can be useful if there are Cross-Origin Resource Sharing (CORS) issues (or if you simply want to obfuscate where the API endpoint is - nobody has to know there’s a plain-http connection to your wordpress server happening).
This is covered in this common issue in our forums.
Often it is possible to refactor a server-based dynamic site as a Jamstack site. However, if this cannot be done, then it won’t be possible to host the site with Netlify.
For example, if your site requires Internet Information Server (IIS) and the .NET framework, you would have to use a different service.
No, there is no direct access to the servers that make up the CDN nodes at Netlify.
We do offer a great deal of flexibility when deploying. You can deploy using the any of the following:
- our web UI
- Git service integrations (automated deploys for repos hosted with GitHub, GitLab Bitbucket)
- our netlify CLI tool
If you are looking to upload new versions of your site directly from your local system, the netlify CLI’s manual deploy method is the recommended way to do this and the “drag & drop” method in the web UI is even simpler.
Netlify is designed for a specific type of website: Jamstack sites. Part of the Jamstack design philosophy is that an application runtime isn’t used by the HTTP server. Quoting the Jamstack.org site again:
The thing that they all have in common is that they don’t depend on a web server.
We hope helps to clarify both that application servers and databases cannot be used (outside of APIs) with Netlify sites and why this is the case. If there are other questions about this, please reply here and we’ll do our best to answer.