+EN version complete

This commit is contained in:
Mike Ziebeck 2023-12-29 13:31:42 +01:00
parent 670c62a6ed
commit 4d291b2ab9
29 changed files with 199 additions and 1 deletions

View file

@ -0,0 +1,198 @@
---
title: Setup Node.JS web server on netcup's EiWoMiSau
description: Learn how to set up a Node.JS web server using hosting package EiWoMiSau
updated_at: 2023-12-29
slug: setup-nodejs-web-server-on-eiwomisau
author_name: Mike Ziebeck
translator_url: https://www.deepl.com
translator_name: DeepL
author_url: https://github.com/mzaiprog
author_image:
author_bio:
tags: [nodejs, web server, eiwomisau]
netcup_product_url: https://www.netcup.eu/bestellen/produkt.php?produkt=2042
language: en
available_languages: [en, de]
---
# Introduction
In this tutorial you will learn how to set up your own Node.JS web server. For this we use Netcup's hosting package: [EiWoMiSau](https://www.netcup.eu/bestellen/produkt.php?produkt=2042).
# Requirements
- Netcup hosting package: [EiWoMiSau](https://www.netcup.eu/bestellen/produkt.php?produkt=2042)
- An own domain already linked to the hosting package incl. [set up SSL certificate](https://helpcenter.netcup.com/en/wiki/web-hosting/enabling-ssl-tls) _(in our example `pentagame-online.de`)_
# Step 1 - Prepare: Host name
In order to be able to use the domain `pentagame-online.de` for various purposes, we first set up the following subdomain: `nodejs-tutorial.pentagame-online.de`.
To do this, we open the Plesk overview of our hosting package and press the [Add Subdomain] button in the dialog for [Websites & Domains].
![Add Subdomain Button](./images_en/01-website-domains-add-subdomain-button.png)
After we have defined `nodejs-tutorial` and `pentagame-online.de` for the name of the subdomain, we make sure, under document root that it matches the subdomain exactly with `/nodejs-tutorial.pentagame-online.de/drop.me`.
**Attention:**
- In addition, the subdirectory `drop.me` refers to the location where Netcup will store the default welcome page, which we **must delete later**.
- This setting can **only be defined once here**.
![Add Subdomain](./images_en/02-website-domains-add-subdomain-name.png)
Below we are redirected to the Plesk overview of our new subdomain.
# Step 2 - Prepare: SSL Certificate
Then we continue by clicking on [SSL/TLS Certificates].
![SSL Certificate Button](./images_en/03-nodejs-tutorial-subdomain-ssl-cert-button.png)
In the following, I assume that a [Let's Encrypt certificate has already been set up for the domain `pentagame-online.de` as described here.](https://helpcenter.netcup.com/en/wiki/web-hosting/enabling-ssl-tls)
Therefore, continue immediately with [Manage].
![Manage SSL Certificate Button](./images_en/04-nodejs-tutorial-subdomain-ssl-cert-manage-button.png)
Here we can save our certificate **temporarily** in *.pem format locally using the download button on the right-hand side.
![Download SSL Certificate Button](./images_en/05-nodejs-tutorial-subdomain-ssl-cert-download-button.png)
And then make it available for the subdomain with [Upload .pem file].
![Upload SSL Certificate Button](./images_en/06-nodejs-tutorial-subdomain-ssl-cert-upload-button.png)
With the set certificate, incoming requests can now also be successfully [Redirect(ed) from http to https]. And by clicking on the domain name, we can quickly return to the overview.
![Redirect HTTPS](./images_en/07-nodejs-tutorial-subdomain-ssl-cert-redirect-https.png)
# Step 3 - Set up: Node.JS
Here we add with [Create Site] ...
![Create Website Button](./images_en/08-nodejs-tutorial-subdomain-create-website-button.png)
... [Node.JS] to our website.
![Add Node.JS](./images_en/09-nodejs-tutorial-subdomain-create-website-nodejs-button.png)
In order to receive more helpful debugger messages later in the event of runtime errors, we set the application mode to [development] and then click on [Enable Node.js].
![Activate Node.JS](./images_en/10-nodejs-tutorial-subdomain-nodejs-activate-button.png)
# Step 4 - Troubleshooting
### Error: app.js not found
The error message that now appears was actually the same in [production] mode. ;-) Regardless of this, it tells us that now is the time to create a Node.JS app first.
And for this we open the [File Manager].
![No App.js File Browser Button](./images_en/11-nodejs-tutorial-subdomain-nodejs-no-appjs-file-browser-button.png)
Then we navigate to the parent directory of `drop.me`.
![File Browser goto Document Root](./images_en/12-nodejs-tutorial-subdomain-nodejs-file-browser-goto-document-root.png)
And create the new file `app.js` there.
![Create New File](./images_en/13-nodejs-tutorial-subdomain-nodejs-no-appjs-create-file.png)
![Create App.js](./images_en/14-nodejs-tutorial-subdomain-nodejs-create-file-appjs.png)
We open the code editor for the newly created `app.js` file.
![Edit App.js](./images_en/15-nodejs-tutorial-subdomain-nodejs-edit-file-appjs.png)
And enter the following example source code.
```js
const http = require('http');
const port = process.env.PORT || 3000;
http.createServer(function(request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end("Hello, World!\n");
}).listen(port);
console.log(`App is running... (port: ${port})`);
```
In terms of content, we create an HTTP web server that responds to all browser requests on port `3000` with status code `200` (OK) and the message: `Hello, World!` of mime type: `text/plain`. However, the port can be freely selected, as it will later be used automatically by NGINX for forwarding HTTP/HTTPS requests.
![Paste App.js Code](./images_en/16-nodejs-tutorial-subdomain-nodejs-paste-sample-code-appjs.png)
Back in the Node.js settings for our subdomain, we try out the "URL of the application" with one click.
![Open URL](./images_en/17-nodejs-tutorial-subdomain-nodejs-open-url.png)
### Error: "Hier (still) entsteht eine neue Webseite"
But the default welcome page of our hosting package appears.
![Default Site](./images_en/18-nodejs-tutorial-subdomain-nodejs-apache-default-site.png)
This is because the primary NGINX server still passes **all** requests to the Apache web server (which can also interpret PHP). So next we disconnect the connection between the two.
To do this, we go back to [Websites & Domains] and to our subdomain `nodejs-tutorial.pentagame-online.de`, where we click on the [Hosting and DNS] tab.
![Hosting and DNS Tab](./images_en/19-nodejs-tutorial-subdomain-hosting-dns-tab.png)
Then we call up the setup for [Apache & nginx],
![Apache and nginx Button](./images_en/20-nodejs-tutorial-subdomain-hosting-dns-apache-nginx-button.png)
... scroll down to nginx settings,
![Apache and nginx Part 1](./images_en/21-nodejs-tutorial-subdomain-apache-nginx-part-1.png)
and deactivate the [Proxy mode].
![Apache and nginx Part 2](./images_en/22-nodejs-tutorial-subdomain-apache-nginx-no-proxy-part-2.png)
Back in the [Dashboard] tab, we open the file manager with [Files].
![Dashboard open Files](./images_en/23-nodejs-tutorial-subdomain-file-browser-button.png)
Then we navigate again to the document root directory of our subdomain. And remove the folder `drop.me` from it, as mentioned at the beginning.
![Delete drop.me](./images_en/24-nodejs-tutorial-subdomain-file-browser-delete-drop-me.png)
Back in the Plesk overview of our subdomain, we can once again see the result of the Node.JS app [Open in web].
![Reopen URL in Browser](./images_en/25-nodejs-tutorial-subdomain-test-website.png)
You are probably still seeing the standard welcome page, just like me. But a reload in the browser...
![Refresh Default Site](./images_en/26-nodejs-tutorial-subdomain-nodejs-apache-default-site-refresh.png)
... then delivers as expected:
![Hello World](./images_en/27-nodejs-tutorial-subdomain-nodejs-hello-world.png)
# Conclusion
Great! You have now successfully made your subdomain fit for the use of your own Node.JS web server.
It's best to test the server's limits, which are still quite narrow at the moment, and
- extend it via package management, e.g. with the [Express Server Framework for Node.JS](https://expressjs.com/en)
- and/or add a MySQL database connection
- or use the Git repository feature of Plesk
# License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# Contributor's Certificate of Origin
Contributor's Certificate of Origin By making a contribution to this project, I certify that:
1) The contribution was created in whole or in part by me and I have the right to submit it under the license indicated in the file; or
2) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same license (unless I am permitted to submit under a different license), as indicated in the file; or
3) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.
4) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the license(s) involved.

View file

@ -1,7 +1,7 @@
---
title: Node.JS Webserver mit Netcup's EiWoMiSau einrichten
description: Lerne, wie man einen Node.JS Webserver mit dem Hosting Paket EiWoMiSau einrichtet
updated_at: 2023-12-27
updated_at: 2023-12-28
slug: nodejs-webserver-unter-eiwomisau-einrichten
author_name: Mike Ziebeck
translator_url:

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB