Web Master Trouble
Users Online
Guests Online: 1

Members Online: 0

Total Members: 3
Newest Member: Proxyhotdeals


Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Last Seen Users
Your ad here below
View Thread
Web Master Trouble » Linux Apache MySQL PHP optimalisation tips tricks » Linux tutorials, Tips & Tricks
Linux tutorials, Tips & Tricks Getting started with SSH An introduction to NGINX, PHP-FPM and MariaDB on CentOS An introduction to NGINX, PHP-FPM and MariaDB on Ubuntu Getting started with OpenVZ! Handle DNS properly with cPanel Munin amass, all your server charts in one place Monitoring server performance with Munin! Getting started with OpenVPN (client) Getting started with OpenVPN (server) Your own mail server with Virtualmin IPtables: IPv6 and more rules
 Print Thread

Tutorial ? The LowEndCluster ? Part 3


Welcome back to the 3rd part of the LowEndCluster tutorial series! Last time we've set up an actual web node which we're going to put behind a 'load balancer', or actually a proxy, in this tutorial. The result will be that it's both available over IPv4 and IPv6.

Before we dive into this neat function of NGINX however, let me get back to the LowEndCluster as a whole. Initially, I had two goals in mind: redundancy and scalability. While working on the cluster, I found out that doing both at the same time provides a lot of challenges, some even at the budget-part. My goal was to have a redundant cluster for less than $50/year and I'm going to retain my focus on that. Automatic fail-over and scaling is something I'd like to cover in future tutorials, but not in this series. This means that our filesystem doesn't technically require KVM machines anymore. I'll do a wrap-up in the end of what I turned out to be using for this tutorial so you have a nice overview.

Anyway, enough babbling. Let's get to work!

This time the tutorial is probably even easier than it was the last time, or the time before that. Creating a proxy with NGINX is actually very easy and you only need to do it once and then copy the contents over to your backup server.

I'm still assuming a Debian-based distribution, but since this is NGINX configuration this should work on any OS which has NGINX installed.

First, let's install NGINX:

sudo apt-get install nginx

Once that's finished, go to the directory with the site configuration files: /etc/nginx/sites-available. In that directory, create a file named 'YOURDOMAIN.conf', so for example: example.net.conf.

In that file (/etc/nginx/sites-available/example.net.conf) past the following content:

server {
listen 80;
listen [::]:80;

server_name example.net;

location / {
proxy_pass http://wordpress.example.net/;

Now, first of all, what we did here is create a 'server' object that tells NGINX a server definition is contained inside it.

The first two lines inside that object:

listen 80;
listen [::]:80;

Tell NGINX to listen on port 80 over IPv4 (first line) and on port 80 over IPv6 (second line). Naturally, if you'd wanted to change the ports, this is where you'd do it. I'm assuming you don't, as that would kind of ruin this whole plan.

server_name example.net;

Put the server name you want NGINX to listen for on this line. You can add multiple like this:

server_name example.net example.com example.org;

Because we're not pinning this server to specific IP addresses, be sure to include any subdomains you want NGINX to listen for as well.

This address will also be the address of your WordPress installation. I recommended last time that you'd use your eventual WordPress domain temporarily for your web node; this is the time to configure that here.

Now, on to the last block:

location / {
proxy_pass http://wordpress.example.net/;

Here we tell NGINX to pass all requests coming to this server to your WordPress web node. I've used an example domain here, but I'd recommend you to pick another domain name for your web nodes (give a different one to each) and configure your primary one here. If that is down, you can easily switch to the other domain and continue serving from that.

With the configuration file all finished, let's enable it so NGINX knows it needs to load this file:

ln -s /etc/nginx/sites-available/example.net.conf /etc/nginx/sites-enabled/example.net.conf

And finally, restart NGINX:

sudo service nginx restart

And you're done! If you've done all right, you should now be able to go to example.net and find it's serving your WordPress installation from your web nodes, using an external database server!

Now, in order to make this redundant (or easy to fix in case it goes down), copy over the above

That's it for this week, short and sweet. There's more cool things you could do with both NGINX and the cluster. For example, you could have NGINX load balance between multiple web nodes very easily. While in this setup that could put some strain on the database server (and eventually the file system), in another setup it could be really useful.

With the current LowEndSpirit pricing, you could even copy this setup to multiple locations and see if you can start serving your visitors from the server closest to them (albeit with a few challenges).

Next time, it's filesystem time and we're going to make that last part redundant as well!

Warning about ParkingCrew.com! Case: ParkingCrew.com acquires NameDrive.com but earnings are not transferred despite assurances and promises. Inquiries about this are ignored! It's just a con compagny. Don't do business with them!
Jump to Forum:
New Thread Post Reply
Use this BBcode or HTML to refer to; 'Tutorial ? The LowEndCluster ? Part 3'
Vergelijkbare onderwerpen
Thread Forum Replies Last Post
Finding your way on your first ever VPS ? Part III Linux tutorials, Tips & Tricks 1 17-10-2016 09:24
Server monitoring with Icinga 2 ? Part 1: the server (Ubuntu host) Linux tutorials, Tips & Tricks 1 17-10-2016 09:21
Server monitoring with Icinga 2 ? Part 2: the node (Ubuntu host) Linux tutorials, Tips & Tricks 1 03-09-2015 07:15
Tutorial ? OpenVPN for internal-ip only virtual machine hosts Linux tutorials, Tips & Tricks 1 13-06-2015 07:15
Tutorial ? The LowEndCluster ? Part 4 Linux tutorials, Tips & Tricks 1 26-05-2015 07:15