Part of a presentation I gave at UNC to show people (computer science students) how remarkably easy it is to create your own website that you have full control over.
read more* First, get a linux box. We already have one setup here. * Just login, run “apt-get install apache2” * Then, you can just go to the IP and a page will load. * You do have to have root access. * Network has to be open on port 80 * Not super useful, you probably want to host from something more than an IP. Next slide, additions. * So buy a domain, then setup an A record that points to your server’s IP * Wait for it to propagate * Then Apache needs to know what pages to load when someone visits that domain * That’s where virtual hosts come in * So first, we’re going to make a directory called “test.com” * create index.html file in test.com that says “welcome to test.com” * Go to /etc/apache2/sites-available/ * cp default to test.com.conf * Change serverName to test.com * Change documentRoot to /var/www/test.com * a2ensite test.com.conf * then run service apache2 reload * And you’re done, you can go to your domain in your browser and those files will be loaded * You can go to /var/log/apache2/access.log to view the access logs. * You can go to /var/log/apache2/error.log to view errors, so see 404’s which can be helpful, etc. Next slide, useful things you should know. * You can edit the crontab to schedule processes. Crontab -e. Specify day, hour, minute etc. * As soon as you setup a server that’s publicly addressable, after a while you’ll notice hundreds of login attempts per day, trying to brute force your ssh. * You can use fail2ban to mitigate, will block offending IPs on a network level temporarily to reduce load and prevent access. * As a linux server admin, you should enable swap as backup, in case your server does run out of RAM at some point. *