diff options
| author | Christian Cleberg <[email protected]> | 2025-11-11 22:49:13 -0600 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2025-11-11 22:49:13 -0600 |
| commit | 51a7a02f0c96d49b68fbcc155414c218207fa270 (patch) | |
| tree | 845af8aad0e8769352efc02fcd1044eed9cc1ec1 /content/blog/2022-02-16-debian-and-nginx.org | |
| parent | 7d3e80ebf1dc770eac0e21890b74f18ba2d15a6b (diff) | |
| download | cleberg.net-51a7a02f0c96d49b68fbcc155414c218207fa270.tar.gz cleberg.net-51a7a02f0c96d49b68fbcc155414c218207fa270.tar.bz2 cleberg.net-51a7a02f0c96d49b68fbcc155414c218207fa270.zip | |
fix grammar in 2022 posts
Diffstat (limited to 'content/blog/2022-02-16-debian-and-nginx.org')
| -rw-r--r-- | content/blog/2022-02-16-debian-and-nginx.org | 121 |
1 files changed, 57 insertions, 64 deletions
diff --git a/content/blog/2022-02-16-debian-and-nginx.org b/content/blog/2022-02-16-debian-and-nginx.org index 575ede5..bec0712 100644 --- a/content/blog/2022-02-16-debian-and-nginx.org +++ b/content/blog/2022-02-16-debian-and-nginx.org @@ -3,34 +3,31 @@ #+description: Step-by-step protocol for transitioning web server infrastructure to Debian operating system, including installation, configuration, and security hardening of Nginx and Agate services. #+slug: debian-and-nginx -* Server OS: Debian +* Server Operating System (OS): Debian -I've used various Linux distributions throughout the years, but I've -never used anything except Ubuntu for my servers. Why? I really have no -idea, mostly just comfort around the commands and software availability. +I've used various Linux distributions throughout the years, but I've never used +anything except Ubuntu for my servers. Why? I really have no idea, mostly just +comfort around the commands and software availability. -However, I have always wanted to try Debian as a server OS after testing -it out in a VM a few years ago (side-note: I'd love to try Alpine too, -but I always struggle with compatibility). So, I decided to launch a new -VPS and use [[https://www.debian.org][Debian]] 11 as the OS. Spoiler -alert: it feels identical to Ubuntu for my purposes. +However, I have always wanted to try Debian as a server OS after testing it out +in a VM a few years ago (side-note: I'd love to try Alpine too, but I always +struggle with compatibility). So, I decided to launch a new VPS and use [[https://www.debian.org][Debian]] +11 as the operating system (OS). Spoiler alert: it feels identical to Ubuntu for my purposes. -I did the normal things when first launching the VPS, such as adding a -new user, locking down SSH, etc. If you want to see that level of -detail, read my other post about -[[https://cleberg.net/blog/how-to-set-up-a-vps-web-server/][How to Set -Up a VPS Web Server]]. +I did the normal things when first launching the VPS (virtual private server), +such as adding a new user, locking down SSH (secure shell protocol), etc. If you +want to see that level of detail, read my other post about [[https://cleberg.net/blog/how-to-set-up-a-vps-web-server/][How to Set Up a VPS +Web Server]]. -All of this has been similar, apart from small things such as the -location of users' home folders. No complaints at all from me - Debian -seems great. +All of this has been similar, apart from small things such as the location of +users' home folders. No complaints at all from me - Debian seems great. * Web Server: Nginx -Once I had the baseline server configuration set-up for Debian, I moved -on to trying out [[https://nginx.org][Nginx]] as my web server software. -This required me to install the =nginx= and =ufw= packages, as well as -setting up the initial UFW config: +Once I had the baseline server configuration set-up for Debian, I moved on to +trying out [[https://nginx.org][Nginx]] as my web server software. This required me to install the +=nginx= and =ufw= packages, as well as setting up the initial UFW (Uncomplicated +Firewall) config: #+begin_src sh sudo apt install nginx ufw @@ -41,9 +38,9 @@ sudo ufw status sudo systemctl status nginx #+end_src -Once I had the firewall set, I moved on to creating the directories and -files for my website. This is very easy and is basically the same as -setting up an Apache server, so no struggles here. +Once I had the firewall set, I moved on to creating the directories and files +for my website. This is very easy and is basically the same as setting up an +Apache server, so no struggles here. #+begin_src sh sudo mkdir -p /var/www/your_domain/html @@ -52,17 +49,17 @@ sudo chmod -R 755 /var/www/your_domain nano /var/www/your_domain/html/index.html #+end_src -The next part, creating the Nginx configuration files, is quite a bit -different from Apache. First, you need to create the files in the -=sites-available= folder and symlink it the =sites-enabled= folder. +The next part, creating the Nginx configuration files, is quite a bit different +from Apache. First, you need to create the files in the =sites-available= folder +and symlink it the =sites-enabled= folder. -Creating the config file for your domain: +Creating the configuration file for your domain: #+begin_src sh sudo nano /etc/nginx/sites-available/your_domain #+end_src -Default content for an Nginx config file: +Default content for an Nginx configuration file: #+begin_src sh server { @@ -87,9 +84,9 @@ sudo ln -s /etc/nginx/sites-available/your_domain /etc/nginx/sites-enabled/ #+end_src This will make your site available to the public (as long as you have -=your_domain= DNS records pointed at the server's IP address)! +=your_domain= DNS (Domain Name System) records pointed at the server's IP address)! -Next, I used [[https://certbot.eff.org/][certbot]] to issue an HTTPS +Next, I used [[https://certbot.eff.org/][certbot]] to issue an HTTPS (Hypertext Transfer Protocol Secure) certificate for my domains using the following commands: #+begin_src sh @@ -99,16 +96,15 @@ sudo ln -s /snap/bin/certbot /usr/bin/certbot sudo certbot --nginx #+end_src -Now that certbot ran successfully and updated my Nginx config files to +Now that =certbot= ran successfully and updated my Nginx configuration files to include a =443= server block of code, I went back in and edited the -config file to include security HTTP headers. This part is optional, but -is recommended for security purposes; you can even test a website's HTTP -header security at [[https://securityheaders.com/][Security Headers]]. +configuration file to include security HTTP headers. This part is optional, but +is recommended for security purposes; you can even test a website's HTTP header +security at [[https://securityheaders.com/][Security Headers]]. -The configuration below shows a set-up where you only want your website -to serve content from its own domain, except for images and scripts, -which may come from =nullitics.com=. All other content would be blocked -from loading in a browser. +The configuration below shows a set-up where you only want your website to serve +content from its own domain, except for images and scripts, which may come from +=nullitics.com=. All other content would be blocked from loading in a browser. #+begin_src sh sudo nano /etc/nginx/sites-available/your_domain @@ -133,35 +129,32 @@ sudo systemctl restart nginx ** Nginx vs. Apache -As I stated at the beginning, my historical hesitation with trying Nginx -was that the differences in configuration formats scared me away from -leaving Apache. However, I prefer Nginx to Apache for a few reasons: +As I stated at the beginning, my historical hesitation with trying Nginx was +that the differences in configuration formats scared me away from leaving +Apache. However, I prefer Nginx to Apache for a few reasons: -1. Nginx uses only one config file (=your_domain=) vs. Apache's two-file +1. Nginx uses only one configuration file (=your_domain=) vs. Apache's two-file approach for HTTP vs. HTTPS (=your_domain.conf= and =your_domain-le-ssl.conf=). -2. Symlinking new configurations files and reloading Nginx are way - easier than Apache's process of having to enable headers with - =a2enmod mod_headers=, enable PHP with =a2enmod php= (plus any other - mods you need), and then enabling sites with =a2ensite=, and THEN - reloading Apache. -3. The contents of the Nginx config files seem more organized and - logical with the curly-bracket approach. This is a minor reason, but - everything just felt cleaner while I was installing my sites and that - had a big quality of life impact on the installation for me. - -They're both great software packages, but Nginx just seems more -organized and easier to use these days. I will certainly be exploring -the Nginx docs to see what other fun things I can do with all of this. +2. Symlinking new configurations files and reloading Nginx are way easier than + Apache's process of having to enable headers with =a2enmod mod_headers=, + enable PHP with =a2enmod php= (plus any other mods you need), and then + enabling sites with =a2ensite=, and THEN reloading Apache. +3. The contents of the Nginx configuration files seem more organized and logical + with the curly-bracket approach. This is a minor reason, but everything just + felt cleaner while I was installing my sites and that had a big quality of + life impact on the installation for me. + +They're both great software packages, but Nginx just seems more organized and +easier to use these days. I will certainly be exploring the Nginx docs to see +what other fun things I can do with all of this. * Gemini Server: Agate -Finally, I set up the Agate software on this server again to host my -Gemini server content, using Rust as I have before. You can read my -other post for more information on installing Agate: -[[https://cleberg.net/blog/hosting-a-gemini-server/][Hosting a Gemini -Server]]. +Finally, I set up the Agate software on this server again to host my Gemini +server content, using Rust as I have before. You can read my other post for more +information on installing Agate: [[https://cleberg.net/blog/hosting-a-gemini-server/][Hosting a Gemini Server]]. -All in all, Debian + Nginx is very slick and I prefer it over my old -combination of Ubuntu + Apache (although it's really just Nginx > Apache -for me, since Debian seems mostly the same as Ubuntu is so far). +All in all, Debian + Nginx is very slick and I prefer it over my old combination +of Ubuntu + Apache (although it's really just Nginx > Apache for me, since +Debian seems mostly the same as Ubuntu is so far). |
