Nginx

The web server is automatically started on computer startup, but can be manipulated separately using:

  • fabsrv nginx.restart

  • fabsrv nginx.start

  • nginx.stop

The configurations exist in a directory named "available". Creating a symlink to them in a directory "enabled" makes them usable by Nginx. To access these directories you need admin rights; modifying them is generally done by copying a "local" version from a user-accessible directory and that is what the functions mentioned here are doing.

To create a new configuration or modify an existing one you can use the command

fabsrv nginx.editconf <name>

With this you can modify the "local" version (which lives in a directory below the nginx-config directory) although strictly speaking you don't need this command for that, it just makes it easier because you don't need to know the location. When done you can copy to the central Nginx configuration using

fabsrv nginx.modconf <name(s)>

This replaces the current version of the configuration file; if you want to have a backup (stored in the local directory) you can use the command

fabsrv nginx.modconfb <name(s)>

There is also a version to append the new configuration to the existing file (and also make a backup), I'm not sure why I made this version because it's not the regular use of this mechanism:

fabsrv nginx.modconfa <name(s)>

To make a new configuration known to the server you can use the following command (it creates the aforementioned symlink):

fabsrv nginx addconf <name(s)>

You can also disable a configuration by having the symlink removed; this is done by the command

fabsrv nginx rmconf <name(s)>

For convenience I also made a command that combines creating and enabling a new configuration:

fabsrv nginx newconf <name(s)>

To check for differences between the local and central configuration I made this command:

fabsrv nginx diffconf <name(s)>

It also has a graphical variant which has the disadvantage of doing the comparions one by one instead of all at once:

fabsrv nginx diffconfg <name(s)>

To see which configurations ther currently are you can use the following command:

fabsrv nginx list

Lastly I made a command to view which virtual servers / domains are associated with which configurations:

fabsrv nginx list-domains