Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › Apache

How to Self-Host Elgg Social Network on a Linux VPS (2026 Guide)

By Freedom251 Team · · 12 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can self-host Elgg on a Linux VPS with Elgg 7.1.1 (the current recommended stable release) or Elgg 6.3.8 LTS. Use PHP 8.3 or newer, MariaDB 10.6 or newer or MySQL 8.4 or newer, a rewrite-capable Apache or Nginx web server, a working mail-transfer agent, and an Elgg data directory outside the public document root. The deployment sequence is: install the supported stack, create a least-privilege database, deploy Elgg, secure the data directory, configure rewrites and timed requests, then finish the browser installer.

What you need before installing Elgg

Elgg is a PHP/MySQL social-networking engine. A VPS gives you control over the operating system, database, web server, uploads and scheduled jobs, but you are responsible for patching, backups, access control, monitoring and mail delivery.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose an Elgg branch

Branch Release listed by the project Release date Best fit Decision check
Elgg 7 7.1.1, recommended stable October 9, 2026 New installations that can use the current branch Confirm every required plugin supports Elgg 7 and your PHP/database versions.
Elgg 6 6.3.8, recommended LTS August 19, 2026 Sites that need the Elgg 6 support horizon or depend on Elgg 6-compatible extensions Check the LTS maintenance policy and plugin compatibility before committing.

These versions are the project’s listed choices in 2026; check the release page immediately before a production deployment because the latest patch can change. Do not assume a plugin that worked on Elgg 6 will work unchanged on Elgg 7.

Supported software requirements

Component Minimum documented requirement Why it matters
Operating system Linux VPS with administrative access Needed to install the web server, PHP, database, mail service and scheduled jobs.
PHP PHP 8.3 or newer Elgg executes as a PHP application; the required extensions must be loaded by the same PHP runtime used by the web server.
PHP extensions GD, INTL, JSON, PDO, XML and multibyte support Image handling, internationalization, database access, XML processing and multibyte text depend on them.
Database MariaDB 10.6 or newer, or MySQL 8.4 or newer Stores users, content, settings and plugin data.
Web server Apache with mod_rewrite and PHP as an Apache module, or Nginx with PHP-FPM over FastCGI Elgg needs URL rewriting and a correctly connected PHP runtime.
Email A properly configured mail-transfer agent (MTA) Notifications, password resets and other mail must be delivered reliably.

Use one PHP version consistently. A common failure is installing extensions for one PHP version while Apache or PHP-FPM runs another. Confirm the command-line PHP binary, Apache module or FPM pool, and database connector all refer to the intended installation.

Plan the VPS layout and service identities

Use a dedicated Unix service identity for the site rather than giving the web server broad access to the whole VPS. Keep the application’s public document root separate from private configuration and uploaded data.

  • Document root: the directory exposed by Apache or Nginx. Only files intended for web requests belong here.
  • Elgg data directory: a separate path outside the document root. Uploaded profile icons, photos and other files are stored there.
  • Configuration: Elgg’s database settings live in elgg-config/settings.php; protect this file from casual reading and unnecessary write access.
  • Database credentials: create a database user used only by Elgg, not by administrative tools or unrelated applications.
  • Backups: back up the database and the external data directory together. A database-only backup cannot restore uploaded files, and an upload-only backup cannot restore users or content.

Elgg’s documentation is explicit: “For security reasons, this folder MUST be stored outside of your document root.” Do not put the data directory under /www/, /var/www/html/ or /public_html/ when that path is publicly served.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install the Linux web, PHP, database and mail stack

The exact package names differ by distribution. On an Ubuntu or Debian VPS, select repositories that provide PHP 8.3 or newer and the required extensions, then install either Apache or Nginx, one database server, PHP, PHP-FPM when using Nginx, and an MTA. On another distribution, use its supported package manager and service names.

Verify the runtime before deploying Elgg

  1. Run php -v and confirm the output is PHP 8.3 or newer.
  2. Run php -m and check for GD, INTL, JSON, PDO, XML and multibyte support. The PDO MySQL driver must also be loaded for a MySQL-compatible database.
  3. Check the database server version with its administrative client and confirm MariaDB 10.6 or newer or MySQL 8.4 or newer.
  4. Confirm the web server can execute a simple PHP test through the same PHP version shown in the browser-facing configuration. Remove the test file after checking.
  5. Send a test message through the configured MTA and inspect its logs. A running local mail service is not proof that messages will reach recipients; configure the service, DNS and relay policy appropriate for your domain.

Choose Apache or Nginx

Area Apache Nginx
PHP execution Supported with PHP as an Apache module. Supported with PHP-FPM over FastCGI.
Rewrite setup Enable mod_rewrite and permit the Elgg override rules. Use the Elgg Nginx distribution configuration and its rewrite rules in the enabled server block.
File layout Point the virtual host at the Elgg document root and keep data outside it. Point the server block at the same public root and pass PHP requests to the correct FPM socket.
Operations Convenient if your team already manages per-directory .htaccess rules. Centralized configuration and PHP-FPM pools are useful when you already operate Nginx.
Logs Check the virtual-host access and error logs plus the PHP/Apache service logs. Check the server-block logs, PHP-FPM logs and the socket or permission errors they report.

Neither server is automatically safer. Correct rewrite rules, ownership, patching, TLS, database restrictions and log monitoring matter more than the choice itself.

Deploy Elgg with Composer or the release archive

Composer deployment

The project recommends the Composer command-line route for administrators comfortable with the shell. Install Composer using the method appropriate for your distribution, run the Elgg project’s documented release command for the branch you selected, and place the resulting application in a directory owned by your deployment identity. Keep the public document root pointed at the directory intended by that release; do not expose the entire parent directory.

After Composer finishes, inspect the tree before making it live. Confirm that elgg-config/, install/config/, the vendor libraries and the public entry point are present. Do not copy a development checkout into production without its production dependencies.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Release ZIP deployment

If you use the release ZIP, download the exact Elgg version you selected, verify the archive before extracting it, extract it into the planned application directory, and preserve the release’s directory structure. The ZIP route avoids a Composer installation on the VPS, but you still need to deploy all files from the same release and repeat the process carefully during updates.

Create the private data directory

  1. Create a directory outside the document root, for example a dedicated path under /srv or another non-public filesystem location.
  2. Give the web-server identity ownership of the directories Elgg must create and write. Keep other users from writing to them.
  3. Use restrictive permissions. When the web-server user owns the directory, mode 750 is a documented suggestion.
  4. Do not use mode 777. Elgg’s documentation says that setting the data directory to 777 may work but is insecure and not recommended.
  5. Record the absolute path, including its trailing slash if the installer asks for one, and enter that exact path during setup.

Create a least-privilege database

Log in to MariaDB or MySQL as an administrator and create a database with a dedicated account. Use a long, unique password stored in your password manager; do not reuse the VPS administrator password.

CREATE DATABASE elgg CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'elgg_app'@'localhost' IDENTIFIED BY 'use-a-long-unique-password';
GRANT ALL PRIVILEGES ON elgg.* TO 'elgg_app'@'localhost';
FLUSH PRIVILEGES;

Replace the database name, username and password with values for your installation. Restrict the account host to the database location. If PHP connects through a separate database host, use that host’s private network address and firewall rules rather than opening the database to the public internet.

Record four values for the installer: database name, database username, database password and database host. For a local database the host is commonly localhost, but use the value that matches your PHP driver and database socket or TCP configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Configure Apache or Nginx for Elgg

Apache checklist

  1. Enable mod_rewrite and the PHP integration used by your chosen PHP version.
  2. Set the virtual host’s document root to Elgg’s public application directory.
  3. Allow the Elgg rewrite rules to load by setting AllowOverride all for the relevant directory, or translate the rules into the virtual-host configuration.
  4. Ensure the correct .htaccess is present. Elgg supplies the distribution file at install/config/htaccess.dist; copy it as required by the release instructions rather than inventing rewrite rules.
  5. Reload Apache and inspect the virtual-host error log if the site returns a 500 response or the installer’s rewrite test fails.

If settings-save requests or long URLs return 404, check both AllowOverride and mod_rewrite. A working home page does not prove that rewrites are working.

Nginx checklist

  1. Copy the release’s install/config/nginx.dist into the enabled sites configuration.
  2. Set the server name, document root and PHP-FPM socket to your domain and installed PHP version.
  3. Confirm that only the intended public directory is served and that private configuration and data paths are not mapped as static locations.
  4. Test the Nginx configuration, reload it, and watch both Nginx and PHP-FPM logs while opening the installer.

Long-URL 404 errors under Nginx usually indicate a missing or altered rewrite rule, an incorrect document root or a site URL that does not match the request host and scheme.

When the installer cannot write settings

If the browser installer cannot create the configuration file, copy settings.example.php to elgg-config/settings.php and fill in the database details manually. Then set ownership and permissions so the web server can read the file and write only where the installation process requires it. Remove any temporary copies containing credentials.

Apply SELinux labels when enabled

On SELinux-enabled systems, ordinary Unix ownership can look correct while access is still denied. Apply the documented httpd_sys_rw_content_t context to the project root, Elgg data directory and their children. Enable httpd_can_network_connect when PHP must make permitted outbound connections, and enable httpd_can_network_connect_db when the web process connects to a database over the network.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
semanage fcontext -a -t httpd_sys_rw_content_t '/path/to/elgg(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/path/to/elgg-data(/.*)?'
restorecon -Rv /path/to/elgg /path/to/elgg-data
setsebool -P httpd_can_network_connect on
setsebool -P httpd_can_network_connect_db on

Use the booleans only when the application’s network behavior requires them, and review SELinux audit messages rather than disabling SELinux globally.

Configure Elgg timed requests with cron

Elgg uses timed requests for background work such as sending notifications and performing database cleanup. A production site needs a recurring cron entry; without it, pages may load while notifications, maintenance and other deferred work quietly accumulate.

  1. Find the cron or timed-request command supplied by the exact Elgg release you installed. The command may be provided by the release’s CLI tooling or by the documented web timed-request mechanism.
  2. Run it manually as the same service identity used by the site and watch for permission, PHP-extension and database errors.
  3. Add a system cron entry at the interval recommended for that release. Use absolute paths to PHP, the Elgg installation and any CLI script.
  4. Redirect output to a dedicated log or the system journal, and rotate that log.
  5. Trigger a known background action, such as a notification, and verify that it completes. Check the cron log and Elgg logs if it does not.

Do not schedule the job as root merely to bypass permissions. Fix ownership or the service identity instead. If you use an HTTP timed request, protect the endpoint as described by the release documentation and monitor its response code.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Finish the browser installer

  1. Open the domain over HTTPS and start the installer.
  2. Correct every requirements warning before continuing. Pay particular attention to PHP 8.3 or newer, the required extensions and the PDO MySQL driver.
  3. Enter the database name, username, password and host created earlier.
  4. Enter the absolute data-directory path outside the document root. Check spelling, ownership, permissions and any required trailing slash.
  5. Set the site URL to the canonical HTTPS address you will use. Avoid switching between an IP address, a temporary hostname and the final domain after installation.
  6. Provide the site name and administrative details.
  7. Complete installation and test registration, login, profile-image upload, password-reset mail and a notification.
  8. Remember that the first account created becomes an administrator. Protect it with a unique password and, where available, stronger account protections.

Production hardening after installation

  • HTTPS and host consistency: redirect HTTP to the canonical HTTPS hostname and ensure the configured site URL matches it.
  • SSH: use key authentication, disable password login where your recovery process permits, restrict administrative access and avoid sharing the root account.
  • Updates: apply operating-system, PHP, database, Elgg and plugin updates on a schedule. Read release notes and test plugin compatibility before each Elgg branch update.
  • Database exposure: bind the database to localhost or a private interface when possible, restrict firewall rules and retain least-privilege grants.
  • Uploads: keep the data directory outside the document root, use restrictive ownership and permissions, and monitor its growth.
  • Backups: perform encrypted, off-server database and data-directory backups; test restoring both to a separate environment.
  • Monitoring: alert on disk exhaustion, failed cron runs, PHP-FPM or Apache/Nginx errors, database failures and mail-queue growth.
  • Logging: retain web-server, PHP, database, cron and authentication logs long enough to investigate incidents, while protecting logs from public access.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot the failures you are most likely to see

The requirements page reports missing PHP support

Check the PHP version and extension list in the web runtime, not only the shell. Install or enable GD, INTL, JSON, PDO, XML, multibyte support and the MySQL PDO driver for the PHP version actually serving requests. Restart Apache or PHP-FPM after changing modules.

A white page appears after entering database settings

Verify that pdo_mysql is installed and loaded, then inspect the PHP and web-server error logs. Confirm the database host, credentials and database server reachability. A blank response is often a hidden PHP fatal error; temporarily increase logging rather than displaying errors to visitors.

The rewrite test fails or long URLs return 404

With Apache, confirm mod_rewrite, AllowOverride all and the correct .htaccess derived from install/config/htaccess.dist. With Nginx, compare the enabled server block with install/config/nginx.dist, check the document root and verify that the PHP-FPM socket exists. Also confirm that the configured site URL matches the domain and HTTPS scheme.

Elgg cannot save settings

Check ownership and permissions on elgg-config/settings.php, the parent directory and the web-server configuration. If the installer cannot create the file, use settings.example.php as the manual starting point, enter the database values, and remove credential-bearing temporary files.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Uploads fail or images do not appear

Verify the data path, its spelling and trailing slash, web-server ownership, restrictive write permissions and SELinux labels. Confirm that the data directory is outside the document root and that the filesystem has free space. Do not solve an upload error by changing the directory to 777.

SELinux reports a denial

Inspect the audit log, apply httpd_sys_rw_content_t to the Elgg project and data paths, restore contexts, and enable the documented network booleans only when required. Re-test the exact operation that failed.

Notifications never arrive

Check that the MTA is configured, the timed-request cron job runs successfully, and the mail queue and delivery logs show the message leaving the VPS. Test password-reset mail as well as ordinary notifications; they exercise the same delivery path but can reveal different address or template problems.

Updating or changing branches safely

Before an Elgg update, take a tested database backup and a complete copy of the external data directory. Record the installed Elgg version, PHP version, database version and enabled plugins. Read the target release requirements and verify each plugin’s compatibility; a core update can expose incompatible extensions even when the previous site was healthy.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Clone or restore the production backup into a staging VPS.
  2. Apply the target Elgg release and required PHP/database changes in staging.
  3. Run the installer’s requirements checks, timed requests and representative user actions, including uploads and email.
  4. Schedule a maintenance window, put the production site into maintenance mode if supported, and repeat the tested deployment.
  5. Keep the previous application files and a rollback plan until login, uploads, database writes, cron and mail have all been verified.

Moving from Elgg 6 LTS to Elgg 7 is a branch migration, not merely a patch update. Treat plugin compatibility and the documented upgrade path as release blockers.

Operational checklist

  • Elgg 7.1.1 or Elgg 6.3.8 selected after checking current releases and plugin support.
  • PHP 8.3+, required extensions and the PDO MySQL driver loaded by the web runtime.
  • MariaDB 10.6+ or MySQL 8.4+ running with a dedicated Elgg database account.
  • Apache rewrite support or the release Nginx configuration installed and tested.
  • Data directory outside the document root, owned by the service identity and not mode 777.
  • SELinux contexts and network booleans applied where applicable.
  • MTA tested for real delivery and cron configured for timed requests.
  • HTTPS, SSH keys, firewall rules, updates, backups and monitoring in place.
  • Browser installer completed; administrator login, uploads, password reset, notifications and scheduled work tested.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

ApacheElggLinux VPSMariaDBMySQLNGINXPHPself-hostingVPS administration

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.