Skip to content
landchad

landchad

This is LandChad.net, a site dedicated to turning internet peasants into Internet Landlords by showing them how to setup websites, email servers, chat servers and everything in between. Starting a website is something that can be done in a lazy afternoon and costs pocket change. Most of the internet’s problems could be solved if more people had their own personal platforms, so the objective of this site is to guide any normal person through the process of installing a website.

landchad.net
landchadlandchad
NETWORK SECURITY AND FIREWALLS

Requiring Passwords for Webpages (HTTP Authentication)

HTTP basic authentication will allow you to secure parts (or all) of your website with a username and password without the trouble of PHP or Javascript. This will work with any Nginx server. ## Installation We will be using the command htpasswd to make username and password pairs. sh apt install apache2-utils The apache utils include a small username-password pair encryption tool. Like the other tutorials on this site, this tutorial is for Nginx, not for Apache servers. Now think of a username and password and remember them. htpasswd -c /etc/nginx/myusers username The -c flag creates a file. You can make the path of this file anywhere outside of your webroot. Obviously the username is up to you as well. Type out your password twice to confirm. You can do this as many times as you'd like. Check out user name password pairs (the password will be securely hashed): cat /etc/nginx/myusers ## Nginx Config and Auth Basic From here, we are going to edit our websites config file in /etc/nginx/sites-enabled. Have in mind which folder you'd like to secure. Add something like this: nginx server { #... location /secret-folder { auth_basic "What's the Password?" ; auth_basic_user_file /etc/nginx/myusers ; } #... } #### Huh? If you're stuck, try finding the line location / { Just below this block is where you should add the custom location block If you'd like to do the opposite, such as making the entire site private except for a public section, do this: nginx server { #... auth_basic "What's the Password?" ; auth_basic_user_file /etc/nginx/myusers ; location /public/ { #... auth_basic off ; } #... } ### IP Addresses If passwords aren't enough we can ban an ip or accept one. nginx location /api { #... allow 192.168.1.23:8080 ; deny 127.0.0.1 ; } If you want to check both a username and password with an ip address, use the satisfy directive. nginx location /api { #... satisfy all ; allow 192.168.1.23:8080 ; deny 127.0.0.1 ; auth_basic "What's the Password?" ; auth_basic_user_file /etc/nginx/myusers ; } ### Complete Example nginx http { server { listen 80; root /var/www/website ; #... location /secret-folder { satisfy all ; allow 192.168.1.3/24; deny 127.0.0.1 ; auth_basic "What's the Password?" ; auth_basic_user_file /etc/nginx/myusers ; } } } Now check your configuration with nginx -t Reload nginx and you're good to go!
landchadlandchad
ENTREPRENEURSHIP AND STARTUPS

Cronjobs

Cron is a service that lets you run scheduled tasks on a computer. These tasks are called cronjobs. If you have already followed the initial course you will have already used cron when you set up Certbot, but we’ll explain how they work generally here. ## What tasks would I want to schedule? You can schedule anything! Some examples of what you might have done already include: - updatedb to update your locate database to let you quickly search for files - certbot to update renewing of your https certs Some tasks that you might want to schedule may include: - Package updates - if you really just want to leave your server alone you can automate updating packages on your server - Backups - you may want to backup certain files every day and some every week, this is possible with cron And many more, anything you can do can be turned into a cronjob. ## Basic Cronjobs This the preferred method for personal tasks and scripts; it's also the easiest to get started with. Run the command crontab -e to access your user's crontab Once you have figured out the command you want to run you need to figure out how often you want to run it and when. I am going to schedule my system updates once a week at 3:30 AM on Mondays. We now have to convert this time (Every Monday at 3:30 AM) into a cron time. Cron uses a simple but effective way of scheduling when to run things. Crontab expressions look like this * * * * * command-to-run The five elements before the command tell when the command is supposed to be run automatically. So for our Monday at 3:30 AM job we would do the following: txt .---------------- minute (0 - 59) | .------------- hour (0 - 23) | | .---------- day of month (1 - 31) | | | .------- month (1 - 12) | | | | .---- day of week (0 - 6) | | | | | * * * * * 30 3 * * 1 apt -y update && apt -y upgrade ### Some notes - On the day of the week option, Sunday is 0 and counting up from there, Saturday will be 6. - * designates "everything". Our command above has a * in the day of month and month columns. This means it will run regardless of the day of the month or month. - The hour option uses 24 hour time. 3 = 3AM, while we’d use 15 for 3PM. ### More examples Let's add another job, our backup job (for the purpose of this our backup command is just called backup). We want to run backup every evening at 11PM. Once we work out the timings for this we can add this new job to the same file as the above by running crontab -e This would mean our full crontab would look like this: txt 0 23 * * * backup ### Consecutive times Suppose we want a command to run every weekday. We know we can put 1 (Monday), but we can also use 1-5 to signify from day 1 (Monday) to day 5 (Friday). txt 0 6 * * 1-5 echo "Wakey, wakey, wagie!" >> /home/wagie/alarm The above echo command runs every Monday through Friday at 6:00AM. ### Non-consecutive times We can also randomly specify non-consecutive arguments with a comma. Suppose you have a script you want to run at the midday of the 1st, 15th, and 20th day of every month. You can specify that by putting 1,15,20 for the day of the month argument: txt 0 12 1,15,20 * * /usr/bin/pay_bills_script ### "Every X minutes/days/months" We can also easily run a command every several minutes or months, without specifying the specific times: txt */15 * * * * updatedb This cronjob will run the updatedb command every 15 minutes. ### Beware of this Rookie Mistake Though... Suppose you want to run a script once every other month. You might be tempted write this: txt * * * */2 * That might feel right, but this script will be running once every minute during that every other month. You should specify the first two arguments, because with * it will be running every minute and hour! txt 0 0 1 */2 * This makes the command run only at 0:00 (12:00AM) on the first day of every two months, which is what we really want. Consult the website crontab.guru for an intuitive and interactive tester of cronjobs. ## User vs. Root Cronjobs It is important to note that user accounts all have different cronjobs. If you have a user account chad and edit his crontab with crontab -e, the commands you add will be run as the chad user, not root or anyone else. Bear in mind that if you need root access to run a particular command, you will usually want to add it as root. ## System-wide cron directories crontab -e is the typical interface for adding cronjobs, but it's important to at least know that system-wide jobs are often stored in the file directory. Some programs which need cronjobs will automatically install them in the following way. Run the command ls /etc/cron* and you should see a list of directories and their contents. The list of directories should look something like below: - /etc/cron.d This is a crontab like the ones that you create with crontab -e - /etc/cron.hourly - /etc/cron.daily - /etc/cron.weekly - /etc/cron.monthly The directories cron.{hourly,daily,weekly,monthly} are where you can put scripts to run at those times. You don't put normal cron entries here. I prefer to use these directories for system wide jobs that don't relate to an individual user. ## Contribution - Mark McNally -- website, Youtube - Edits and examples by Luke
MARK MC NALLY
landchadlandchad
FREIGHT SHIPPING AND PORTS

Get a Domain Name

## Terms Domain name The name of a website that you type in an address bar. This site's domain name is LandChad.net. Top-level domain (TLD) The extension of a domain name, like .com, .net, .xyz, etc. Registrar A service authorized to reserve a domain name for you. When domain names first sell, they usually sell for very cheap, but once someone buys one, they have the rights to it until they decide to sell it, often for much, much more money. Therefore, it's a good idea to reserve a domain name ASAP, even if you didn't intend on doing anything big with it. So let's register your domain name! ## How Domains can be registered at any accredited registrar and there are a lot to choose from. Some major names are Host Gator, Blue Host, Name Cheap or Dream Host. There are also sites that are more private, like Njalla and Cheap Privacy, which register a domain for you under their name, but still allow you access to it. (Normally all websites must be registered with the ICANN with a real name and address, but these sites allow you to bypass that.) Choosing a registrar is not permanent, and you can transfer domains to a different registrar if you get a better deal later, so in most cases, you can just choose one and let’s head on… ### Basic info about domain names - Domain names usually require a very small yearly fee to keep registered, usually around $12 for most generic TLDs. There are some "specialty" TLDs that are more expensive, but .com, .xyz and other basic TLDs are that cheap. - Once you own a domain, it is yours as long as you pay the yearly fee, but you can also sell it to someone for however much you want. - Domain names do not hold your data or your website; instead, you add "DNS settings" that direct people connecting to your domain to your IP address. The purpose of a domain name is so that people don't have to remember your IP address to find your website! ### Looking for domain names Let's go to our registrar’s site and you can search for domain names. You can look for whatever domain name you want. Domains that are already bought and owned by someone else might have the option to "Backorder," but it's always best to get one that is unowned, like these: Note the differences in prices. Some "specialty" TLDs like .game and .io charge a much larger fee, although you might want one. Some domains above, like .xyz and .org have reduced prices for the first year. Choose the domain you want and buy it. These .xyz domains are a steal now on sale. That's all you have to do to own a domain name! As you register a domain, you can also setup an automatic payment to pay your fee yearly to keep your domain. Easy as pie. Now we will get a server to host your website on.
landchadlandchad
FREIGHT SHIPPING AND PORTS

Get a Server

Once you have a domain name, you'll need a server to host all your website files on. In general, a server is just a computer that is constanly broadcasting some services on the internet. Servers connected to the internet can be extremely useful with or without proper websites attached to them. You can be your own website, email, file-sharing service and much more. ## Getting a VPS A Virtual Personal Server (VPS) is a very cheap and easy way to get a web server. Without you having to buy expensive equipment. There are a lot of online businesses that have massive server farms with great internet connection and big power bills that allow you to rent a VPS in that farm for pocket change. A VPS usually costs $5 a month. Sometimes slightly more, sometimes slightly less. That's a good price for some internet real-estate, but in truth, you can host a huge number of websites and services on a single VPS, so you get a lot more. I might have a dozen websites, an email server, a chat server and a file-sharing services on one VPS. The VPS provider that I'll be using for this guide is Vultr, since that is what I use. Vultr provides a free one-month $100 credit to anyone who starts an account through this referral link of mine so you can play around with their services with impunity. ## Starting your server in two minutes or less Start an account on Vultr and let's get started. Vultr (and other VPS providers) usually give you a choice in where and what exactly your VPS is. #### Server Location In general, it doesn't hugely matter what physical location you have your server in. You might theoretically want it close to where you or your audience might be, but if you host a server in Singapore for an American audience, they won't have to be waiting a perceptibly longer time to load the site. Some locations might have different abilities and plans than others. For example, in Vultr, their New York location has optional DDOS protection and also has some cheaper $3.50 servers. #### Operating System/Server Type I especially recommend Debian 11 for an operating system for your server. Debian is the "classic" server OS and as such, I make my guides on this site for Debian 11. If you use another OS, just know that your millage may vary in terms of you might need to change some instructions here minorly. #### Server size You finally have a choice in how beefy a server you want. On Vultr, I recommend getting the cheapest option that is not IPv6 only. Web hosting and even moderately complicated sites do not use huge amounts of RAM or CPU power. If you start doing more intensive stuff than hosting some webpages and an email server and such, you can always bump up your plan on Vultr without data loss (it's not so easy to bump down). #### Additional features On Vultr, there are some final checkboxes you can select additional options. You will want to check Enable IPv6 and also Block Storage Compatible. We will be setting up IPv6 because it's important for future-proofing your website as more of the web moves to the IPv6 protocol. Block storage is the ability (if you want) to later rent large storage disks to connect to your VPS if desired. You just might want that as an option, so it's worth activating now. ### Done! Once you select those settings, your server will automatically be deployed. Momentarily, you will be able to see your server's IP addresses which will be used for the next brief step:
VULTR
landchadlandchad
BLOCKCHAIN AND DISTRIBUTED LEDGERS

Monero

Monero (abbreviated XMR) is easily the cryptocurrency most actually used as such. Unlike Bitcoin, Monero is actually private and has very low transaction fees. That makes it a good idea to get a Monero wallet and add an address on your website where you can receive donations. ## Generate a Monero wallet Go to Monero's official site and you can download either the GUI (graphical) or CLI (command-line wallet). Some Linux distributions will have these packages in their repositories (monero and monero-gui on Arch-based distributions). If you are a Windows user, note that you will probably get some kind of warning that you are installing something malicious. This is because many malicious pieces of software include crypto miners in them. This wallet, obviously, does include one as well, because it has the ability to mine if you want. You can disregard these messages and as that official site mentions, you can follow their directions to check the integrity of the download with SHA256. Once you install and run the wallet program, you will get a menu like this: Now if you want to start using Monero and using it as a pro, you can choose to download the whole blockchain which will maximize your transactional privacy, however for this tutorial or setting up a wallet, we can just do the Simple Mode and save our bandwidth. In fact, if you are paranoid, you can disconnect your computer from the internet while generating a wallet. Now we choose to create a wallet. Now we get the most important and sensitive part, you private mneumonic seed. These words are sacred! They are your money! To be clear, they are randomly generated words that seed the randomness required to unlock whatever money you receive or hold. Never show these words to anyone, don't even keep them on your computer, but write them down and store them securely in real life in a safe or somewhere where only you have access. It goes without saying that the seed above that we generated for this tutorial should never be used by anyone since it is public on the internet and anyone could easily take the funds from the wallet. Finally, we get to the main wallet screen. Now we see your public sharable wallet receiving address. It is the thing that starts with 4 and is too long to be included in the image below labeled "Primary address." Click the clipboard next to it to copy the whole sequence (which will be more than 90 letters and numbers) to your clipboard. This is your address. Put it on your website and you can receive donations! You can also click to save that QR code image and you can put it up on your website and people will be able to scan it and send you Monero. When scanned, that QR code will read as the public donation address. ## What do I do now? You can now receive Monero/XMR donations! All you need to do is put either your full address or your QR code on your site and people can send you tips in Monero. Here is the address we use for this site (i.e. not the compromised wallet generated above): 84RXmrsE7ffCe1ADprxLMHRpmyhZuWYScDR4YghE8pFRFSyLtiZFYwD6EPijVzD3aZiEpg57MfHEr1pGJNPXyJgENMnWrSh It's now up to you how and where to display these on your site.