Manage Web Server

SolidGroundUX DocumentationSolidGroundUX
NL

Configure, manage, validate, and inspect an Nginx web server

Source: target-root/usr/local/libexec/solidgroundux/manage-web-server.sh

Configure, manage, validate, and inspect an Nginx web server

Public functions

Internal functions
FunctionPurposeArgumentsOutput
_web_ask_selectionPresent a numbered selection prompt and return the chosen item to its caller.- $2: Name of the output shell variable.—
_web_server_load_stateRead web-management settings from the state file when available.——
_web_server_save_stateSave web-management settings to the configured state file.——
_dryrun_completeReport the dry-run result without executing the requested host change.——
_web_server_package_installedTest whether Nginx is installed.——
_web_server_storage_rootResolve the configured SolidGroundUX storage root.——
_web_server_rootResolve the configured web content root.——
_web_server_save_rootPersist the configured web content root.- $1: Root filesystem directory.—
_web_server_installed_docs_rootUse SGND_WEB_DOC_INSTALLED_ROOT from the environment or web-server.cfg;—Prints a configured absolute path, remapping /usr paths for staged roots.
_web_server_enabled_sitesList enabled Nginx sites.——
_web_server_available_sitesList available Nginx sites.——
_web_server_read_site_configAllow inspection of root-owned configuration files without changing- $1 Existing Nginx site identifier.Writes the configuration contents to stdout.
_web_server_validate_site_nameValidate an Nginx site name.- $1: Value to inspect or write.—
_web_server_current_dnsResolve the first configured non-loopback DNS server.——
_web_server_local_ipv4Resolve this server's primary IPv4 address.——
_web_server_offer_dns_recordOptionally register an internal AD DNS A record.- $1: Web hostname for which a DNS record may be created.—
_web_server_remove_dns_recordDuring site removal, delete only a confirmed A record pointing at this host.- $1: Web hostname whose DNS entry may be removed.—
_web_server_site_document_rootResolve the document root for an Nginx site.- $1: Configured Nginx site name.—
_web_server_remove_document_contentRemove all content below a document root.- $1: Absolute web document root whose content is to be removed.—
_web_server_ensure_directoryCreate and prepare a web content directory when needed.- $1: Filesystem path to inspect.—
_web_server_ensure_https_fallbackA removed hostname must never serve another site's content. Ubuntu's——
_web_server_reloadValidate and reload Nginx.——
_web_server_step_install_packagesInstall Nginx and publishing prerequisites.——
_web_server_step_startEnable and start Nginx.——
_web_server_prepareRun the complete Web Server preparation sequence in one management process.——
_web_server_configure_rootSelect or create the web content root.——
_web_server_manage_serviceManage nginx.service state and startup behavior.——
_web_server_configure_firewallAllow HTTP and HTTPS through UFW.——
_web_server_create_siteCreate and enable an Nginx site.——
_web_server_ensure_siteNoninteractive, idempotent site provisioning for an approved remote deployment.——
_web_server_ensure_directory_for_publishNoninteractive preparation/repair of a dedicated publishing directory.——
_web_server_configure_dnsReuse existing interactive AD DNS setup via a direct action.——
_web_server_enable_siteEnable an available Nginx site.- $1: Optional: configured Nginx site name.—
_web_server_disable_siteDisable an enabled Nginx site.- $1: Optional: configured Nginx site name.—
_web_server_change_document_rootChange the document root for an Nginx site.- $1: Optional: configured Nginx site name.—
_web_server_remove_siteRemove an Nginx site configuration.- $1: Optional: configured Nginx site name.—
_web_server_remove_site_contentRemove the contents of a site's document root.- $1: Optional: configured Nginx site name.—
_web_server_list_sitesList Nginx sites and document roots.——
_web_server_configure_httpsEnable HTTPS using an existing certificate or a locally generated self-signed- $1: Optional: configured Nginx site name.—
_web_server_export_https_certificateMake the public certificate of an HTTPS-enabled Nginx site available to the- $1 Optional Nginx site identifier.—
_web_server_configure_basic_authAdd or remove password protection without changing the public site or TLS setup.- $1: Optional: configured Nginx site name.—
_web_server_update_markdown_uploadKeep Python implementation in lib/solidgroundux/py, not a duplicate——
_web_server_configure_markdown_uploadBind the upload service to localhost, outside the document root, with- $1: Optional: configured Nginx site name.—
_web_server_site_summaryKeep the selected site's hostname, root, status, and protection visible.- $1: Configured Nginx site name.—
_web_server_manage_sitesList sites, choose the active site, and keep its details above the actions.——
_web_server_default_docs_addressReturn a sensible documentation web address.——
_web_server_configure_documentation_siteCreate or select the Nginx site used to publish SolidGroundUX documentation.——
_web_server_documentation_pathsNever sync a missing, nested, identical, or symlinked documentation root.- $1: Output variable for documentation source path.—
_web_server_documentation_changesCompare the full tree with rsync's read-only itemized dry-run, including- $1: Source path.—
_web_server_update_documentationThis action only updates an EXISTING configured documentation site.——
_web_server_documentation_statusOnly installed-documentation sources can be compared automatically;——
_web_server_statusShow web-server status and configuration.——
_web_server_validateValidate the web-server role.——
_run_actionDispatch the requested management action to its implementation.- $1: Management action to execute.—

Description

Configure, manage, validate, and inspect an Nginx web server.

Usage

Run the executable from its shell command (or installed wrapper):

manage-web-server --action status
manage-web-server --dryrun --action configure-root

Script-specific options:

  • --action NAME, -a: Management action (supported actions: prepare, install, start, configure-root, manage-sites, ensure-site, ensure-directory, configure-dns, configure-documentation, documentation-status, update-documentation, service, firewall, validate, status).
  • --site-name VALUE: Nginx site identifier for ensure-site.
  • --web-address VALUE: Hostname for ensure-site.
  • --document-root VALUE: Absolute document root for ensure-site.
  • --deployment-user VALUE: Unprivileged SSH publishing account.