Change to a profile style page, added post about multiple git repos. Need to write script to auto-update blog posts.

This commit is contained in:
Norm Rasmussen
2023-09-22 17:44:49 -04:00
parent a6586baf38
commit 2d1410bf45
32 changed files with 1758 additions and 242 deletions

View File

@ -1,9 +1,34 @@
+++
title = 'Trouble Hosting Hugo with Nginx'
date = 2023-09-20T11:33:22-04:00
draft = false
tags = ["tips & tricks", "self-hosted", "troubleshooting" ]
+++
---
title: 'Trouble Hosting Hugo with Nginx'
date: 2023-09-20T11:33:22-04:00
draft: false
tags: ["git", "backups", "commandline"]
author: "Me"
showToc: true
TocOpen: false
draft: false
hidemeta: false
description: "Learn one way to push your git changes to multiple remote repositories."
disableHLJS: false # to disable highlightjs
disableShare: false
disableHLJS: false
hideSummary: false
searchHidden: true
ShowReadingTime: true
ShowBreadCrumbs: true
ShowPostNavLinks: true
ShowWordCount: true
ShowRssButtonInSectionTermList: true
UseHugoToc: true
cover:
image: "<image path/url>" # image path/url
alt: "<alt text>" # alt text
caption: "<text>" # display caption under cover
relative: false # when using page bundles set this to true
hidden: true # only hide on current single page
---
## Intro
For the last 3 days, I have been spending a few hours after working trying to figure out why my brand new Hugo site was not
loading correctly on my sub-domain. For context, I use Nginx to host all my apps and servers, most of them using reverse
@ -19,6 +44,8 @@ same sites and posts I found the day before! It was getting frustrating.
Wouldn't you know... it was one of the simplest solutions that got it all working. Here's a breakdown of what I was seeing
and my hypothesis.
## Errors
*Console Errors:*
* Incorrect MIME type --> `css` files being set as `text/html` type.
@ -53,6 +80,8 @@ was the very first I clicked on, so I owe them my thanks since their site was th
You can find a list of all the blogs I stumbled upon in this weird and fluctuating journey of doing something as simple as
sharing my static files on an nginx web server.
## Solution
In the end, [newbs.rocks blog post](https://newbs.rocks/posts/hugo-setup/) on setting up Hugo with nginx provided me a config
example that worked for my setup. I think part of what happened was that as I was cycling through all the blog posts and
StackOverflow posts, I would remove one or two lines (usually the one or two I changed from the previous post's
@ -68,7 +97,8 @@ very likely that whatever you're facing isn't isolated to just you.
Now that I have this up and running, I need to write (and post!) a script that will pull from my repo, change directory
ownership, and reload nginx.
### Working nginx config file {#nginx-config}
## Resources
### Working Nginx Config File {#nginx-config}
```config
# ------------------------------------------------------------
@ -107,7 +137,7 @@ server {
}
```
### Blogs and Sites I used
### Blogs and Sites
* [Gideon Wolfe - Deploying a static Hugo site with NGINX](https://gideonwolfe.com/posts/sysadmin/hugonginx/)
* [Pvera - Deploying a simple static website using Nginx and Hugo](https://pvera.net/posts/create-site-nginx-hugo/)

View File

@ -0,0 +1,83 @@
---
title: 'Pushing a Single Local Git Repo to Multiple Remote Repos'
date: 2023-09-22T15:07:10-04:00
tags: ["git", "backups", "commandline"]
author: "Me"
showToc: true
TocOpen: false
draft: false
hidemeta: false
description: "Learn one way to push your git changes to multiple remote repositories."
disableHLJS: false # to disable highlightjs
disableShare: false
disableHLJS: false
hideSummary: false
searchHidden: true
ShowReadingTime: true
ShowBreadCrumbs: true
ShowPostNavLinks: true
ShowWordCount: true
ShowRssButtonInSectionTermList: true
UseHugoToc: true
cover:
image: "<image path/url>" # image path/url
alt: "<alt text>" # alt text
caption: "<text>" # display caption under cover
relative: false # when using page bundles set this to true
hidden: true # only hide on current single page
---
## Why push to multiple repos?
Do want to use both Github & and a Self-hosted Git Repo? Here's how I've been doing it!
I really enjoy self-hosting services that I use everyday. One of those includes a git-style version control software. In my
case, I've been running [Gitea](https://gitea.com/) for a few years now and have been really satisfied with everything (except
for that one time that an update broke all my templates).
At the same time, there's the entire social element that comes with Github along with having your public repositories
available in a place that other developers are already spending time on. Instead of adding, committing, commenting, and
pushing on two different repos, here's how I run all those commands just once and push it to both repos.
_Note: An import git note to remember is that you can only _push_ to multiple remote repositories. You'll have to select
which repo you want to be the main pull repository. Have this be `remote-url-one` in the below instructions._
## Command Line Instructions
These instructions come after you initialize the repo in your directory. Make sure you have both of your remote git URLs
handy at this point!
```zsh
git remote add {{ remote-name }} {{ remote-url-one }}
git remote set-url --add --push {{ remote-name }} {{ remote-url-one }}
git remote set-url --add --push {{ remote-name }} {{ remote-url-two }}
```
To confirm that everything worked as expected, run `git remote -v` to check your remote repos. You should see one repo in
there twice, once for `(push)` and once for `(fetch)`.
I use the remote name "all" for multiple repos, so here's what my `git remote -v` returns:
```zsh
> git remote -v
all https://git.rsmsn.co/Normanras/rsmsn_blog.git (fetch)
all https://git.rsmsn.co/Normanras/rsmsn_blog.git (push)
all https://github.com/Normanras/rsmsn_blog.git (push)
all https://git.rsmsn.co/Normanras/rsmsn_ddblog.git (push)
```
To now push to your repositories, after adding and committing run `git push {{ remote-name }} --all`. My command is
`git push all --all` (see why I use all, now?)
Here's the man page description on the `--all` flag:
```zsh
--all
Push all branches (i.e. refs under refs/heads/); cannot be used
Instead of naming each ref to push, specifies that all refs under
end, locally updated refs will be force updated on the remote end,
Do everything except actually send the updates.
same as prefixing all refs with a colon.
```
And that's it! You should be able to push everything to both of your repos fairly easily now with this new set commands.

View File

@ -1,18 +1,42 @@
+++
title = 'Tutorial: Move from NginxProxyManager to Nginx'
date = 2023-08-05T15:23:51-05:00
draft = false
tags = ["tutorial", "self-hosted", ]
+++
---
title: 'Tutorial: Move from NginxProxyManager to Nginx'
date: 2023-08-05T15:23:51-05:00
draft: false
tags: ["git", "backups", "commandline"]
author: "Me"
showToc: true
TocOpen: false
draft: false
hidemeta: false
description: "Learn one way to push your git changes to multiple remote repositories."
disableHLJS: false # to disable highlightjs
disableShare: false
disableHLJS: false
hideSummary: false
searchHidden: true
ShowReadingTime: true
ShowBreadCrumbs: true
ShowPostNavLinks: true
ShowWordCount: true
ShowRssButtonInSectionTermList: true
UseHugoToc: true
cover:
image: "<image path/url>" # image path/url
alt: "<alt text>" # alt text
caption: "<text>" # display caption under cover
relative: false # when using page bundles set this to true
hidden: true # only hide on current single page
---
## Goal
A Tutorial Repo for migrating your Nginx Proxy Manager proxy setup to Nginx. I wrote this originally for [this reddit
post](https://www.reddit.com/r/selfhosted/comments/15j4v80/minitutorial_migrating_from_nginx_proxy_manager/) and to post this [my Github profile](https://github.com/Normanras/Npm_to_Nginx). Thought my website would also be a good place to share it for any passers-by.
## Goal
To give clear instructions to help users migrate from using [Nginx Proxy Manager](https://nginxproxymanager.com/) (NPM) to standard [Nginx](https://docs.nginx.com/). This tutorial is not exhaustive and there are many other implementations of this transition. I would recommend checking out the many Nginx [Documentation Sites](http://nginx.org/en/docs/) and tutorials to learn more.
### Introduction
## Introduction
If you're anything like me and you got into the self-hosted/homelab/diy game sometime within the last 5 years, you've likely been recommended to use Nginx Proxy Manager as one of the choice Reverse Proxy services. If you've also been paying attention to various self-hosted communities, you may have also come across Christian Lempa's Video on [trusting smaller self hosted projects and tools](https://youtu.be/uaixCKTaqY0).
@ -22,7 +46,7 @@ Whether you follow Christian away from NPM or not, it dawned on me that while NP
*Contributing: This is not all encompassing of Nginx possibilities. Including instructions for various installation methods, using OpenResty, and any other migrations or use cases would help the community. If you'd like to add in additional information on how to migrate from NPM to Nginx, that is welcome. Simply submit a PR with your steps.*
### TL;DR - Quick Steps
## TL;DR - Quick Steps
1. Copy the following contents (including sub-directories) from the NPM `/data/nginx` directory to the Nginx `/etc/nginx` folder:
@ -42,7 +66,7 @@ Whether you follow Christian away from NPM or not, it dawned on me that while NP
5. Test your changes with `nginx -t`. Make appropriate changes if there are error messages.
### Pre-requisites & Assumptions
## Pre-requisites & Assumptions
I am using an Ubuntu VM with NPM and it's db as a Docker Container while Nginx is installed natively on the machine. You don't have to use this setup exactly, but I am making a few assumptions as to what you should have access to before you begin. I am also using custom SSL certs, but theoretically, the transition should be the same when using Lets Encrypt.
@ -57,11 +81,11 @@ I've added some example files to show before and after changes to this repo and
* For a linux install, they should be accessible at `/etc/nginx`.
* You know how to edit files at the command line using `nano`, `vi`, `vim`, `neovim`, `emacs`, or something else.
### Nginx Files
## Nginx Files
Nginx uses the `nginx.conf` file and within that file, it will include your proxy files. These exist under `./nginx/sites-enabled/`. In the main `nginx.conf` file, the line `include /etc/nginx/sites-enabled/*;` will bring in those files to the config file, making the proxies accessible.
### How to Transition - Detailed Version
## How to Transition - Detailed Version
1. Since NPM uses Nginx under the hood, they are both, by default, going to try and use ports 80 and 443 to serve up your apps and content. Turn off both systems.
@ -120,13 +144,13 @@ nginx: configuration file /etc/nginx/nginx.conf test is successful
And that's it! You can now restart your nginx service on the host and access all your sites just as if you were using Nginx Proxy Manager! Make sure you take a look at your logs and system's status should nginx fail to start.
### Additional Information/Appendix
## Additional Information/Appendix
#### File Trees for NPM (in container) and Nginx (on host)
### File Trees for NPM (in container) and Nginx (on host)
*I did not expand every directory in these trees. Only the ones that are pertinent for reference in this tutorial.*
#### NGINX
### NGINX
```bash
├── conf.d
@ -191,7 +215,7 @@ And that's it! You can now restart your nginx service on the host and access all
└── win-utf
```
#### NPM
### NPM
```bash
├── data