OpenCart Deployment Overview¶
Prerequisites¶
The following system parameters and network settings are required for the application to function correctly:
-
Operating System: Debian, Ubuntu, CentOS, Rocky Linux, or AlmaLinux.
-
Access Rights: Full
rootaccess is required to perform the installation. -
Ports:
-
80/tcp— HTTP (used for certificate validation). -
443/tcp— HTTPS (main traffic). -
8080— Internal Apache web server port.
FQDN of the final panel on hostkey.in domain¶
A dynamic subdomain template is used to access the application:
| Parameter | Value |
|---|---|
| Prefix | opencart |
| Domain | hostkey.in |
| Full Template | opencart{Server_ID_from_Invapi}.hostkey.in/opencart |
File and Directory Structure¶
Main paths to files and directories in the system:
-
/var/www/html/opencart— OpenCart application root directory. -
/root/opencart— Temporary directory containing source code from the repository. -
/root/nginx— Docker Compose configuration files for Nginx. -
/data/nginx/user_conf.d— Custom Nginx configurations (including proxying). -
/data/nginx/nginx-certbot.env— Environment variables file for the Nginx container.
Application Installation Process¶
Deployment is performed by cloning the OpenCart repository (branch 3.0.x.x) and configuring the web server.
Main stages:
-
Installation of system dependencies (PHP, MySQL, Apache/httpd, Git).
-
Cloning source code from GitHub to
/root/opencart. -
Copying application files to
/var/www/html/opencart. -
Renaming configuration files from
config-dist.phptoconfig.php(including theadmindirectory). -
Configuring the Apache web server to run on internal port
8080.
Access Rights and Security¶
Security is provided by the following mechanisms:
-
Firewall: Only necessary ports
80and443are open.firewalldis used in RedHat-family systems. -
File Ownership:
-
For Debian/Ubuntu: user
www-data. -
For RHEL/CentOS/AlmaLinux: user
apache. -
Directory Permissions: Mode
0755is set for application directories.
Databases¶
A database and a user with limited privileges are created for OpenCart operation:
| Parameter | Value |
|---|---|
| Database Name | opencart |
| Username | opencart |
| Access Rights | All privileges (ALL) on database opencart.* |
Docker Containers and Execution¶
The Nginx container with the Certbot module is used to manage SSL certificates.
Container: nginx
-
Image:
jonasal/nginx-certbot:latest -
Network Mode:
host -
Ports: Uses host ports (80, 443).
-
Volumes:
-
nginx_secrets:/etc/letsencrypt— Certificate storage. -
/data/nginx/user_conf.d:/etc/nginx/user_conf.d— Proxy configurations. -
Environment Variables:
-
CERTBOT_EMAIL: Email for Let's Encrypt registration. -
Restart Policy:
unless-stopped.
Application Update Instructions¶
Updates are performed by updating the configuration and restarting containers: docker compose pull && docker compose up -d (in directory /root/nginx).
Permission Settings¶
File permissions are set as follows:
-
The system web server user (
www-dataorapache) is the owner of directories/var/www/html/opencartand/var/www. -
Ownership is applied recursively to ensure the web server has access to application files.
Configuration Files and Data Location¶
OpenCart configuration includes:
-
Main file:
/var/www/html/opencart/config.php. -
Admin file:
/var/www/html/opencart/admin/config.php.
Available Connection Ports¶
| Port | Protocol | Purpose |
|---|---|---|
80 | TCP | HTTP (for certificate validation) |
443 | TCP | HTTPS (main site access) |
8080 | TCP | Internal Apache port (local) |
Starting and Stopping the Application¶
Managing the Nginx-Certbot container:
-
Start:
docker compose up -d(from/root/nginx). -
Reload Nginx Configuration:
docker compose exec -T nginx nginx -s reload. -
Stop:
docker compose down.
Proxy Servers¶
The nginx-certbot container is used as a reverse proxy.
Proxy settings:
-
The
Hostheader is passed for correct OpenCart redirects. -
The
X-Forwarded-Protoheader is passed with the value$schemeso that PHP understands the request arrived via HTTPS.