Nginx Deployment Overview on Server¶
Prerequisites¶
The following parameters and conditions are required for the web server to function correctly:
| Parameter | Value |
|---|---|
| Operating System | Debian or Ubuntu |
| Package Manager Access | apt |
| Access Rights | root (or via sudo) |
| Ports | 80 (HTTP), 443 (HTTPS) |
FQDN of the final panel on hostkey.in domain¶
A dynamic domain name template based on the server ID is used for the service operation.
| Parameter | Value |
|---|---|
| Prefix | nginx |
| Domain | hostkey.in |
| Full Template | nginx{Server_ID_from_Invapi}.hostkey.in |
File and Directory Structure¶
The following directories are created during the deployment process to store data and configurations:
-
/etc/nginx/sites-available/— storage for available site configuration files. -
/etc/nginx/sites-enabled/— symbolic links to active configurations. -
/var/www/html— web content root directory (ownerwww-data). -
/var/www/letsencrypt— directory for ACME challenge validation (ownerwww-data). -
/etc/nginx/user_conf.d— user-defined Nginx configuration files. -
/etc/letsencrypt/live/— storage for SSL certificates.
Application Installation Process¶
Deployment is performed by installing packages via the system package manager and configuring the web server:
-
Update
aptrepository cache. -
Install components:
nginx,certbot,python3-certbot-nginx, andopenssl. -
Create necessary directories with appropriate access permissions.
-
Configure a temporary HTTP server for Let's Encrypt validation.
-
Obtain SSL certificates via Certbot in
--webrootmode. -
Redirect traffic from HTTP to HTTPS.
Access Rights and Security¶
System security is ensured by the following mechanisms:
-
Use of the
www-datauser for web content directories. -
Restricted access permissions for configuration files (
0644). -
Automatic Nginx reload after certificate renewal via a script in
/etc/letsencrypt/renewal-hooks/deploy/reload-nginx.sh.
Docker Containers and Execution¶
Docker containers are not used in this configuration; the application is deployed directly into the operating system as a system service.
Application Update Instructions¶
Updates are performed by updating packages or by rerunning the installation script: apt update && apt upgrade nginx certbot
Permission Settings¶
Access rights for the main directories are set as follows:
| Directory | Owner | Group | Mode |
|---|---|---|---|
/var/www/html | www-data | www-data | 0755 |
/var/www/letsencrypt | www-data | www-data | 0755 |
Configuration Files and Data Location¶
The web server configuration is divided into standard and user parts:
-
Main site file:
/etc/nginx/sites-available/{FQDN}.conf. -
User settings:
/etc/nginx/user_conf.d/*.conf. -
Certificates:
/etc/letsencrypt/live/{FQDN}/.
Available Connection Ports¶
| Port | Protocol | Purpose |
|---|---|---|
| 80 | TCP (HTTP) | Redirect to HTTPS and ACME validation |
| 443 | TCP (HTTPS) | Encrypted web traffic (HTTP/2 supported) |
Starting and Stopping the Application¶
Service management is performed via systemd:
-
Start:
systemctl start nginx -
Stop:
systemctl stop nginx -
Reload configuration:
systemctl reload nginx -
Test config syntax:
nginx -t