Blog page

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.

Webserver 101

2016-02-19 00:00:00 +0000

I want to learn how to setup a Personal Server for my future projects

Static Website

Why am I interested in Static Website Generator?

Nginx

Setup Nginx is pretty straight forward
It is possible to use one server and listening to different locations, like github

Git

This is my first time trying to setup Git repo on Linux box.
It is pretty good fun really.

Jekyll

Jekyll is a popular static website generator

Git and Jekyll

Without permission to use SSH at work, git-http-backend is a pretty neat way for me access my repo
Setting up the HTTP is slightly bit challenging, unlike SSH, since this doesn’t work out of the box
I have spent a good amount of time trying to figure it out why my ‘push’ command doesn’t work (yep! user permission problem)

Doing this I have a chance to learn

  • some NGINX script
  • some CGI script
  • a user permission problem (chmod chown to the rescue)

DDNS and Router setup

I’m using CloudFlare for a Free DNS Service
I use this following Python script to update my router IP to CloudFlare
https://github.com/AmirAzodi/cloudflare_ddns

setting up cron job
add a file called ‘cf-ddns-cronjob’ in /etc/cron.d folder
in the file add this single line to make the task run every hour
0 * * * * _username /usr/bin/python ~/cf-ddns/cf-ddns.py >/dev/null 2>&1

http://www.thesitewizard.com/general/set-cron-job.shtml

NGINX Service at startup

This way I don’t have to redo all the setup everytime the server is rebooted

  1. Remove Apache2 Service (Apache is in Startup script by Default)
  2. Add Nginx Service
update-rc.d -f apache2 remove
update-rc.d nginx defaults

Useful Unix CMD

to see all the running services
sudo service --status-all
To start a daemon at startup, defaults => default run levels 2,3,4 and 5
update-rc.d service_name defaults
To remove
update-rc.d -f service_name remove

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.