SSD cloud hosting for cheap

Posted
Categorized as Code, Software Tagged , , , , ,
image

I decided to try Linode
Cloud hosting

for 10USD (500PHP) a month. You get a high performance VPS which can run several sites for cheap, the only catch is you have to set it up and maintain it yourself. Here’s what I did to get mine up and running in a couple of minutes:

I started by creating an Ubuntu 16.04 LTS node,
then secured my server with their Securing Your Server guide. I also created another user group to make uploading files later easier, then add the non-root user to that group:

sudo adduser <username> www-data
sudo chgrp -R www-data /var/www; sudo chmod -R g+rw /var/www
sudo find /var/www -type d -print0 | sudo xargs -0 chmod g+s

I installed Apache next with their guide: Hosting a Website.  I then change some settings in my Apache config but adding some mods I use like mod_rewrite:

sudo a2enmod rewrite

I then install mySQL and lock it down using the following commands, which are also found in the Linode Guide:

sudo apt-get install mysql-server
sudo mysql_secure_installation

The I optimize my my.cnf for my puny 2GB server (/etc/mysql/my.cnf):

[mysqld]

max_allowed_packet = 1M
thread_stack = 128K
max_connections = 75

table_open_cache = 32M
key_buffer_size = 32

Ubuntu 16.04 LTS does not have support for PHP5 anymore so I used PHP7, so I installed that with the following commands:

sudo apt-get -y install php7.0 libapache2-mod-php7.0

then I install some extensions I need like mySQL, curl etc. THe first commands list the available PHP extensions, then second installs the ones I use.

sudo apt-cache search php7.0

sudo apt-get -y install php7.0-mysql php7.0-curl php7.0-gd php7.0-intl
php-pear php-imagick php7.0-imap php7.0-mcrypt php-memcache
php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc
php7.0-xsl php7.0-mbstring php-gettext

We’ll need to install postfix also so PHP’s mail() function will work.

sudo
apt-get install postfix

Be sure to set “Internet Site: in the configuration dialog. The sendmail_path should be pre-configured correctly already, if not simply set it to:
/usr/sbin/sendmail -t -i

I now Install my FTP server, I use FileZilla since I use the client on my machine natively, then simply connect via SSH/SFTP

sudo apt-get install filezilla

Once that is done, I simply point my domains to my server IP. Linode offers a DNS Manager but I prefer to use GoDaddy’s for simplicity. Hen the IP resolves, I test all my settings then I am off!

UPDATE:

When adding new sites or downloading scripts via wget you’ll need to set permissions again to be able to modify them via FTP:  So I add my FTP user to the www-data group so I do not have permission errors.

sudo usermod -a -G www-data <username>
sudo chmod -R 775 /var/www
sudo chown -R www-data:www-data /var/www

Leave a Reply