Deployment Overview of OpenCart on Server¶
Prerequisites and Basic Requirements¶
The OpenCart application is designed to run on the following operating systems:
-
CentOS
-
Rocky Linux
-
AlmaLinux
-
Ubuntu
-
Debian
The server must have root privileges to perform the installation. The deployment requires the following network ports to be open for inbound traffic:
-
Port 80 (HTTP)
-
Port 443 (HTTPS)
Application Installation Process¶
The OpenCart version 3.0.x.x is deployed by cloning the source code from the official GitHub repository and copying it to the web server directory. The installation process involves the following steps:
-
The source code is cloned into the
/root/opencart/directory. -
The application files are copied from
/root/opencart/upload/to the web root. -
Default configuration files are renamed to remove the
-distsuffix. -
A MySQL/MariaDB database named
opencartis created. -
A database user named
opencartis created with full privileges on theopencartdatabase.
File and Directory Structure¶
The application files are organized as follows:
-
Source Directory:
/root/opencart/(Contains the cloned repository) -
Web Root:
/var/www/html/opencart/(Publicly accessible files) -
Configuration Files:
-
/var/www/html/opencart/config.php(Store configuration) -
/var/www/html/opencart/admin/config.php(Admin configuration)
-
Databases¶
The database layer utilizes MySQL or MariaDB, which is installed and configured locally on the server.
-
Database Name:
opencart -
Database User:
opencart -
Password: The password is set to the SSH password defined in the environment.
-
Socket Locations:
-
On Debian/Ubuntu systems:
/run/mysqld/mysqld.sock -
On RedHat/CentOS/AlmaLinux systems:
/var/lib/mysql/mysql.sock
-
Proxy Servers and Web Server Configuration¶
The deployment utilizes standard web servers depending on the operating system family:
-
Apache2: Used on Ubuntu and Debian systems.
-
HTTPD: Used on CentOS, Rocky, and AlmaLinux systems.
The web server service is enabled to start automatically on boot and is restarted immediately after the deployment. No reverse proxy or custom SSL configuration (such as Nginx or Certbot) is included in this deployment; standard ports 80 and 443 are configured for access.
Permission Settings¶
File and directory permissions are set to ensure the web server can execute the application securely:
-
Directory:
/var/www/html/opencart-
Owner/Group:
www-data(Debian/Ubuntu) orapache(RedHat family) -
Mode:
0755
-
-
Directory:
/var/www-
Owner/Group: Recursively set to
www-dataorapachebased on the OS. -
All subdirectories and files within the web root inherit these ownership settings.
-
Access Rights and Security¶
Security settings are adjusted based on the operating system:
-
IPv6: On Debian and Ubuntu systems, IPv6 is disabled at the system level by modifying
/etc/sysctl.confwith the following entries:-
net.ipv6.conf.all.disable_ipv6 = 1 -
net.ipv6.conf.default.disable_ipv6 = 1 -
net.ipv6.conf.lo.disable_ipv6 = 1
-
-
Firewall: On RedHat-based systems (CentOS, Rocky, AlmaLinux), the
firewalldservice is configured to allow traffic on ports 80/tcp and 443/tcp in thepubliczone permanently.
Starting, Stopping, and Updating¶
Service management is handled via the systemd service manager.
-
To check the status of the service:
-
Debian/Ubuntu:
systemctl status apache2 -
RedHat/CentOS/AlmaLinux:
systemctl status httpd
-
-
To restart the service:
-
Debian/Ubuntu:
systemctl restart apache2 -
RedHat/CentOS/AlmaLinux:
systemctl restart httpd
-
-
To stop the service:
-
Debian/Ubuntu:
systemctl stop apache2 -
RedHat/CentOS/AlmaLinux:
systemctl stop httpd
-
-
To start the service:
-
Debian/Ubuntu:
systemctl start apache2 -
RedHat/CentOS/AlmaLinux:
systemctl start httpd
-
Location of Configuration Files and Data¶
| Component | Path | Description |
|---|---|---|
| Main Config | /var/www/html/opencart/config.php | Store frontend configuration |
| Admin Config | /var/www/html/opencart/admin/config.php | Admin panel configuration |
| Database Socket (Debian/Ubuntu) | /run/mysqld/mysqld.sock | MySQL connection point |
| Database Socket (RedHat) | /var/lib/mysql/mysql.sock | MySQL connection point |
| System Network Config | /etc/sysctl.conf | IPv6 disable settings |