mirror of
https://github.com/archtechx/nix.git
synced 2025-12-12 03:24:02 +00:00
Compare commits
2 commits
1731e68e5f
...
e87e666252
| Author | SHA1 | Date | |
|---|---|---|---|
| e87e666252 | |||
| dbc52af28c |
2 changed files with 24 additions and 0 deletions
21
README.md
21
README.md
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
A collection of scripts and configuration files for our use of Nix tooling.
|
A collection of scripts and configuration files for our use of Nix tooling.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> You may want to read [**this article**](https://stancl.substack.com/p/deploying-laravel-on-nixos) for more detailed information.
|
||||||
|
|
||||||
## Setting up a new server
|
## Setting up a new server
|
||||||
|
|
||||||
This is just for getting a working NixOS installation with `/etc/nixos/configuration.nix` deployed onto a generic cloud VM.
|
This is just for getting a working NixOS installation with `/etc/nixos/configuration.nix` deployed onto a generic cloud VM.
|
||||||
|
|
@ -171,6 +174,24 @@ The module doesn't handle www redirects automatically. This may be added in the
|
||||||
|
|
||||||
At this time, I'd recommend handling basic redirects like that on Cloudflare.
|
At this time, I'd recommend handling basic redirects like that on Cloudflare.
|
||||||
|
|
||||||
|
### Default nginx server
|
||||||
|
|
||||||
|
Out of the box, if nginx cannot match an incoming request's host to a specific virtual host it will
|
||||||
|
just use _some_ vhost. You can prevent behavior that by adding a module like this:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
services.nginx.virtualHosts."catchall" = {
|
||||||
|
default = true;
|
||||||
|
locations."/".return = "444";
|
||||||
|
rejectSSL = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This creates a `default_server` vhost that returns an empty response to any request. The name of the
|
||||||
|
vhost is irrelevant.
|
||||||
|
|
||||||
### Authenticated Origin Pulls (AOP)
|
### Authenticated Origin Pulls (AOP)
|
||||||
|
|
||||||
To make your sites reachable ONLY using Cloudflare, you can use [authenticated origin
|
To make your sites reachable ONLY using Cloudflare, you can use [authenticated origin
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,10 @@ in {
|
||||||
networking.firewall.allowedTCPPorts = [ 80 ] ++ lib.optionals ssl [ 443 ];
|
networking.firewall.allowedTCPPorts = [ 80 ] ++ lib.optionals ssl [ 443 ];
|
||||||
|
|
||||||
# Create welcome message for user
|
# Create welcome message for user
|
||||||
|
# todo: the created /etc file should ideally be 0750
|
||||||
environment.etc."laravel-${name}-bashrc".text = ''
|
environment.etc."laravel-${name}-bashrc".text = ''
|
||||||
|
export PATH="$HOME/.config/composer/vendor/bin/:$PATH"
|
||||||
|
|
||||||
# Laravel site welcome message
|
# Laravel site welcome message
|
||||||
echo "Welcome to ${name} Laravel site!"
|
echo "Welcome to ${name} Laravel site!"
|
||||||
echo "Domains: ${lib.concatStringsSep ", " domains}"
|
echo "Domains: ${lib.concatStringsSep ", " domains}"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue