Custom configurations in NGINX for AlmaLinux mirror

Custom NGINX Configurations for AlmaLinux Mirroring

I currently have two clients who requested an AlmaLinux mirror. With the documentation and everything else, it was really simple. However, they asked if I could customize the NGINX view to make it more personalized, so I developed something like this from a fork I found online:

However, this requires making some changes to NGINX to be able to achieve this and that leads me to wonder if the following changes can impact its use as a mirror.

        autoindex on;

	#Send the data in JSON
        autoindex_format json;
        addition_types application/json;

	#Calling from SERVERNAME/autoindex/*
        add_before_body /autoindex/header.html;
        add_after_body /autoindex/footer.html;

	#Need to tell that we are sending HTML
        add_header Content-Type text/html;

If you need more information, let me know. And thank you very much for your time.

What do you get when you load individual file (with wget or curl)?
For example:

curl --output test.rpm https://yourhost/somepath/9.5/BaseOS/x86_64/os/Packages/bash-5.1.8-9.el9.x86_64.rpm

Will the file test.rpm be identical to the bash-5.1.8-9.el9.x86_64.rpm on the repo?

If yes, then your decorations affect only the browser users, not dnf. I presume.

I understand, because this only actually modifies the autoindex views; the files can then be retrieved individually the same way.

Thank you very much!

While I see that your question has been resolve already, I do want to add:

This looks so nice! If you wanted to write something up about how you accomplished it, I think I’d be happy to link to it from the wiki page where we talk about mirrors.

1 Like

Of course, I’ll write a proper article about how it works, along with the source code, so anyone who wants to can use it.

When I have it, I’ll share it here.

1 Like