CentOS

Nginx, Node, MySQL on VPS

This is a writeup to setup full node stack on a VPS instance. The min memory requirement for the VM is 256M, but ideally should be 512M or higher. I'm currently using VPS instances from www.ramnode.com. It describes how to setup a VPS (virtual private server) to run Nginx, Node.js and MySQL on CentOS 6.x. Here's a quick overview of how to secure a VPS (virtual private server) running CentOS 6.x and configure it. Secure the server Setup iptables Setup MySQL Setup Nginx Setup Node.js SECURE THE SERVER passwd root useradd myuser passwd myuser visudo Add line: myuser    ALL=(ALL)    ALL mkdir ~/.ssh cat id_rsa.pub >> ~/.ssh/authorized_keys chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys vi /etc/ssh/sshd_config PermitRootLogin no PasswordAuthentication no sudo…

Configure Sendmail

Configuring an email server to not get flagged as spam sender is no small feat, but these small tweaks will help your email server cross the hump. It's not a complete configuration guide for sendmail but a collection of few healthy tweaks that should put your email server in better light when viewed by Google, Microsoft, Yahoo and others. Overview: Setup STARTTLS for sendmail Setup DKIM for sendmail Add SPF record in DNS Add reverse DNS lookup Setup STARTTLS for sendmail STARTTLS is the SMTP command to "Start Transport Layer Security" i.e. to turn on SSL. It it used when authenticating senders. Install CA certs Download revoke.crl Disable TLS for local clients Configure and compile sendmail.mc Restart sendmail service # install certs on server su root cd /etc/ssl/certs wget http://www…

Ghost.js on CentOS

Ghost.js is clean blogging only software with minimalistic design aesthetics and responsive web design. It comes with pretty decent functionality out of the box and its themes can be extended easily using handlebars. The bhira.net blog is running on Ghost.js and I wrote this post as a recollection of the steps I followed in setting up this server. This post describes how to setup Ghost.js blogging software on a CentOS server. These instructions are meant for a production server and will use MySQL for storage and run nodejs using pm2 (process manager for Node). Nginx is used as a proxy server for nodejs. Here are the main steps: Setup MySQL Setup Nginx Setup nodejs Setup ghost.js Setup pm2 Setup theme SETUP MYSQL Install Remi repository for CentOS 6 which depends on Fedora EPEL repository…

Nginx, PHP on VPS

This is an update to the original post for setting up Apache, PHP on CentOS. Last year has been great and there is an abundance of vendors providing VPS on the cheap. My goto website for checking the latest on VPS vendors is www.lowendbox.com. For this post I went with a tiny 128MB VPS from www.ramnode.com. This server setup is for Cent OS 6.x with Nginx + PHP-FPM + MySQL. It describes how to setup a VPS (virtual private server) to run Nginx, PHP and MySQL on CentOS. The VPS uses a tiny amount of memory (total server memory is 128MB) and is running on CentOS 6.x. The intent is to setup a fully functional server that has been secured using iptables and configured to use Nginx, PHP-FPM and MySQL for production. It uses CentOS services to manage all the applications and is configured to use l…

IPTables for CentOS

Whenever you get a new RedHat or CentOS instance you want to secure it by setting up firewall rules using the builtin in iptables. If you spinoff an Amazon EC2 instance then you'd be doing the equivalent using Security Groups, which are a slightly higher level concept but essentially performs the same function. If running a VPS on barebones CentOS, iptables is the easiest option. Word of Caution: Its easy to lock yourself out of the system if you make a mistake when configuring iptables. I prefer writing all the rules in a script file, double checking the commands to make sure I'm not closing SSH on port 22. Also, its a good idea to remain logged in the current SSH shell after executing iptables rules and then attempt to login in a new SSH shell to ensure you still have access to the s…

Nameserver on CentOS

This post describes how to setup a nameserver on CentOS. The setup is intended to service DNS (domain name system) queries for this server itself. The nameserver is generic and can be used to provide DNS lookup for other websites as well, but the original intention of the post was to setup a fully contained server which services its own DNS queries. Since this original post I’ve started using Amazon Route53 which provides a highly available and scalable Domain Name System (DNS) web service. SETUP NAMESERVER yum list bind-* yum install bind-chroot.x86_64 (if needed) cp /usr/share/doc/bind-/sample/etc/named. /var/named/chroot/etc cp /usr/share/doc/bind-/sample/var/named/named. /var/named/chroot/var/named chown -R named:named /var/named vi /etc/resolv.conf vi /var/named/chroot/et…

Apache, PHP on VPS

This post describes how to setup a VPS (virtual private server) to run Apache, PHP and MySQL on CentOS. Usually I configure only the LAMP stack on dev servers, but I had to go through some additional configuration when setting up a production web server with Apache + MySQL + PHP5 on CentOS 5.8 running on VPS. VPS servers are pretty cheap and the best way is to start with a bare bones server running CentOS 5.8 and then you can configure only the things you need. This gives you complete control on what runs on the server, but then you need to setup DNS nameserver and iptables firewall. This VPS instance uses a tiny amount of memory (total server memory is 128MB) and is running on CentOS 5.8. The intent is to setup a fully functional server that runs DNS nameserver, is secured using iptabl…