Why Is My Website Down? A Contabo VPS Server (Fixed!)

My VPS server specs is: Package Name: VPS S SSD, Processor: 4 cores, RAM:8 GB, Storage: 200 GB (100% SSD), Bandwidth: 200 Mbit/s Run on: Ubuntu 22.04, Price: With the same price I got much better specs compared to other hosting provider, checkout here.

Firstly I love the fact that I can use the server to host several websites of my own without paying much and got decent server specs for a good price.

However I found that sometimes my websites are down without knowing the caused.

Here are step by step I toook to resolved the problem:

1. Login to your server using PuTTy and check if your swap file is exist, use command $ sudo swapon –show if the result is empty it means you don’t have a swap file, like mine below:

note: I use root user, this is not a best practice, you should use other than root user and use sudo to execute command that require admin rights.

why is my website down1

You can also use command $ free -h

why is my website down2

Check your existing free space first, mine have 167Gb available as I only use it for 10%.

why is my website down3

Create a file for swap. I use 8G because my RAM is 8G, for RAM2-8G use the same size for swap file.

why is my website down4

Once created set permission to 600 to prevent regular user using that swap file.

why is my website down5

Create Linux swap area on the file

why is my website down6

the output will be like this:

why is my website down7

activate the swap file

why is my website down8

Make the changes permanent /etc/fstab file:

$ sudo nano etc/fstab and paste following line /swap.img swap swap defaults 0 0

why is my website down9

write the changes and exit from nano. Check if the swap is now active. Mine below is active and the size is 8G

why is my website down10

why is my website down11

adjusting the swappiness file value. Check the current value

why is my website down12

For most Linux users 60 is enough, but if you want to change the lower value to 10 use command.

sudo sysctl vm.swappiness=10

for me I left the value to 60 for now and see if the server is now run smoothly.

The original source is: https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-22-04/

Share Article:

ywinardi@gmail.com

Writer & Blogger

Considered an invitation do introduced sufficient understood instrument it. Of decisively friendship in as collecting at. No affixed be husband ye females brother garrets proceed. Least child who seven happy yet balls young. Discovery sweetness principle discourse shameless bed one excellent. Sentiments of surrounded friendship dispatched connection is he. Me or produce besides hastily up as pleased. 

Leave a Reply

Your email address will not be published. Required fields are marked *

Edit Template

About

Appetite no humoured returned informed. Possession so comparison inquietude he he conviction no decisively.

© 2024