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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Yes—you can run WordPress on Ubuntu Linux with Apache and place the site behind Cloudflare without a managed platform. The reliable sequence is to install Apache, PHP and its extensions, install a supported MariaDB or MySQL release, create a dedicated database and user, deploy the upstream WordPress archive in its own web root, configure an Apache virtual host, complete the browser-based WordPress installer, then protect the Cloudflare-to-origin connection with an Origin CA or publicly trusted certificate. Use Cloudflare’s Full (strict) mode only after Apache is serving a certificate that covers the hostname.

This guide follows WordPress.org’s current requirements as accessed in 2026: PHP 8.3 or newer, MariaDB 10.11 or newer or MySQL 8.0 or newer, and HTTPS. Apache is a recommended web server. The commands and examples use example.com; substitute your real domain, server address and strong database credentials.

What do you need before installing WordPress?

Prepare the server, DNS and credentials first. A short checklist prevents most installation failures.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • An Ubuntu server with administrative access through a non-root account that can use sudo.
  • A registered domain whose DNS can be changed. You will eventually point an A or AAAA record at the server and then decide which records Cloudflare proxies.
  • At least one hostname for the site, such as example.com, and, if required, www.example.com.
  • PHP 8.3 or greater, MariaDB 10.11 or greater or MySQL 8.0 or greater, and HTTPS support. These are WordPress.org’s current recommended versions, not a guarantee that every older Ubuntu release provides them in its default repositories.
  • A plan for database backups, WordPress-file backups and rollback. Cloudflare protects traffic; it is not a substitute for backups.

Keep your SSH access separate from web traffic. The DNS record used for SSH should not be treated as a web record, and origin firewall rules should be managed independently of Cloudflare’s proxy setting.

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Which WordPress, Apache and Cloudflare architecture should you choose?

For a single Ubuntu server, the simplest supported layout is Apache serving the WordPress directory, PHP executing through Apache’s PHP integration, and Cloudflare proxying HTTP and HTTPS to the origin. You can move to PHP-FPM later if process isolation or multiple sites requires it.

Deployment choice Package and version currency PHP process model Database administration Certificate and proxy model Backup and rollback Best fit
Upstream WordPress archive with Apache The archive comes from WordPress.org; Ubuntu packages provide Apache, PHP and database software. The Ubuntu tutorial prefers the upstream archive over the Ubuntu Archive WordPress package. Apache’s PHP integration is straightforward, but PHP workers are not isolated into separate FPM pools. You create and secure MariaDB or MySQL yourself. Cloudflare can proxy the site; Origin CA encrypts the Cloudflare-to-origin leg. Use Full (strict) after certification. You must schedule and test your own file and database backups. One site or a small self-managed server.
Apache with PHP-FPM Uses the same Ubuntu PHP packages, but lets you select and tune FPM services and pools. Separate PHP-FPM workers can provide stronger per-site isolation and independent resource limits. Still self-managed unless the database is external. The same Cloudflare certificate choices and proxy modes apply. Still requires an explicit backup and rollback plan. Several sites, separate pools or stricter resource controls.
Managed WordPress service Version availability, update policy and server layout depend on the provider rather than your Ubuntu packages. Process isolation is provider-specific. Administration may be reduced, but the exact controls vary. Cloudflare and certificate integration vary by provider. Provider snapshots may exist, but verify retention and restoration before relying on them. Readers who do not want to administer Ubuntu, Apache and a database.

The rest of this article implements the first row. Nothing in the installation requires a paid Cloudflare plan or a managed host; those are separate operational choices.

How do you update Ubuntu and install Apache, PHP and extensions?

Update the package index and install Apache, PHP, the PHP MySQL connector and the extensions used by the Ubuntu WordPress tutorial. Use the package names available for your Ubuntu release, then verify the resulting PHP version before continuing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Connect over SSH with your administrative account and update the system:

    sudo apt update
    sudo apt upgrade
  2. Install Apache, PHP, the Apache PHP module, the database connector and commonly required WordPress extensions:

    sudo apt install apache2 php libapache2-mod-php php-mysql php-curl php-gd php-mbstring php-xml php-zip

    If your Ubuntu tutorial lists additional extensions for the release you are using, install those as well. The important requirement is that PHP can connect to MySQL or MariaDB and provide the extensions expected by WordPress and its plugins.

  3. Check the PHP version and service state:

    php -v
    sudo systemctl status apache2

    Do not proceed with an unsupported PHP version merely because the command succeeds. WordPress.org currently recommends PHP 8.3 or later.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  4. Enable Apache modules needed for WordPress URLs and HTTPS:

    sudo a2enmod rewrite
    sudo a2enmod ssl
    sudo systemctl restart apache2

Ubuntu’s Apache default page should be reachable by the server’s address at this stage. If it is not, check that the local firewall and any cloud security group allow web traffic, and inspect sudo journalctl -u apache2 for a syntax or port error.

How do you install and secure MariaDB or MySQL for WordPress?

WordPress requires a MySQL-compatible database and a database user that can access that database. Create a separate database and least-privilege user instead of using the database administrator account in WordPress.

Install the database server

Choose MariaDB or MySQL according to the versions available for your Ubuntu release and your maintenance policy. The current WordPress.org recommendation is MariaDB 10.11 or newer or MySQL 8.0 or newer.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
sudo apt install mariadb-server mariadb-client
sudo systemctl enable --now mariadb

If you choose MySQL instead, install the corresponding Ubuntu MySQL server and client packages and use the same SQL concepts below. Do not install both database servers on the same default port unless you have a specific reason and know how their services will be isolated.

Run the database hardening wizard

On MariaDB installations, run:

sudo mariadb-secure-installation

Answer the prompts according to your security policy: remove anonymous accounts, disallow remote administrator login unless it is explicitly required, remove the test database and reload privilege tables. The exact prompts differ between database releases, so read each one rather than blindly accepting defaults.

Create the database and application user

Open the database console as an administrator:

sudo mariadb

Then create a database, a dedicated account and permissions. Replace the example password with a long, randomly generated value and store it in your password manager.

CREATE DATABASE wordpress CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'replace-with-a-long-random-password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

The account is limited to the WordPress database and local connections. If your database is on another host, use a deliberately restricted host value and firewall rule rather than changing it to a wildcard without a reason.

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

How do you download WordPress into an Apache web root?

Use the current archive from WordPress.org rather than the WordPress package in the Ubuntu Archive. This is the installation method preferred by the Ubuntu tutorial because it follows the upstream release.

  1. Create a dedicated web root:

    sudo mkdir -p /srv/www/wordpress
  2. Download the current WordPress archive from the WordPress.org download page into a temporary directory, verify that the download completed, and extract it. The archive normally contains a directory named wordpress.

  3. Copy or move the extracted files into /srv/www/wordpress. Keep the directory separate from other virtual hosts so a mistake in one site cannot overwrite another.

  4. Set ownership and conservative permissions:

    sudo chown -R www-data:www-data /srv/www/wordpress
    sudo find /srv/www/wordpress -type d -exec chmod 755 {} ;
    sudo find /srv/www/wordpress -type f -exec chmod 644 {} ;

Giving the web server ownership makes the browser installer and normal update operations convenient, but it also increases the impact of a compromised PHP process. On a multi-site server, consider a per-site Unix user and a PHP-FPM pool so one site does not own another site’s files. Whatever model you select, do not make the entire web root world-writable.

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

How do you configure an Apache virtual host for WordPress?

Create a virtual host that points Apache at the WordPress directory, permits the rewrite rules used by WordPress, and serves the requested hostname. A hostname mismatch here is a common cause of incorrect redirects later.

  1. Create a site configuration file:

    sudo nano /etc/apache2/sites-available/wordpress.conf
  2. Use this HTTP configuration, replacing the names and paths if your layout differs:

    <VirtualHost *:80>
        ServerName example.com
        ServerAlias www.example.com
        DocumentRoot /srv/www/wordpress
    
        DirectoryIndex index.php
    
        <Directory /srv/www/wordpress>
            AllowOverride All
            Options FollowSymLinks
            Require all granted
        </Directory>
    
        ErrorLog ${APACHE_LOG_DIR}/wordpress_error.log
        CustomLog ${APACHE_LOG_DIR}/wordpress_access.log combined
    </VirtualHost>

    AllowOverride All permits WordPress’s .htaccess rewrite rules. If you disable overrides for policy reasons, reproduce the required rewrite rules in the virtual host instead.

    Rank #3
    Sale
    Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
    • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
    • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
    • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
    • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
    • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
  3. Enable the site, disable the default site if it is occupying the request, test the configuration and reload Apache:

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
    sudo a2ensite wordpress.conf
    sudo a2dissite 000-default.conf
    sudo apachectl configtest
    sudo systemctl reload apache2

A successful Syntax OK confirms configuration parsing, not that DNS, PHP or the database is correct. Use the Apache error log and the browser response when diagnosing the next stage.

How do you complete the WordPress browser installation?

Once the domain resolves to the server and Apache serves the virtual host, open the domain in a browser. WordPress should display its setup screen and ask for the database details.

  1. Enter the database name wordpress, database user wordpress_user, the password you created, database host localhost and the default table prefix unless you have a documented reason to change it.

  2. Submit the form. WordPress writes its configuration and tests the database connection. A connection error usually means the database name, username, password, host or service state is wrong; it is not fixed by changing Apache rewrite rules.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  3. Create a separate WordPress administrator account. Do not reuse the operating-system login or the database administrator account, and do not use an easily guessed username.

  4. Sign in to the dashboard, set the site title and preferred permalink structure, and apply core, theme and plugin updates only after confirming that backups work.

At this point the site may work over plain HTTP. Do not select Cloudflare’s strict encrypted origin mode until Apache has a valid certificate and listens on port 443.

How do you add the domain to Cloudflare and configure DNS?

Add the domain to Cloudflare, use the nameservers Cloudflare assigns, and create DNS records that point to the Ubuntu server. Proxy only the web records that should pass through Cloudflare.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Add the domain in the Cloudflare dashboard and complete the nameserver change at the registrar. Nameserver changes can take time to propagate, so test both the authoritative DNS result and the browser request.

  2. Create an A record for the IPv4 address and, if applicable, an AAAA record for IPv6. Use the exact hostname configured in Apache. Add a separate record for www only if you serve it.

    Rank #4
    Sale
    UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
    • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
    • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
    • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
    • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
    • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
  3. Turn the Cloudflare proxy on for HTTP and HTTPS web records after the origin responds correctly. Keep SSH and other administrative records DNS-only or separate; Cloudflare’s HTTP proxy is not an SSH firewall.

  4. Keep the origin firewall configured independently. It should permit the web traffic your design requires and preserve your administrative access even if Cloudflare settings change.

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

If you use both an apex hostname and www, decide which one is canonical in WordPress and redirect the other deliberately. Inconsistent hostnames can produce duplicate URLs even when TLS is configured correctly.

How do you install an Origin CA certificate and enable HTTPS?

Cloudflare Origin CA encrypts the connection from Cloudflare to Apache. It is intended for origins that receive traffic through proxied records; browsers do not generally trust an Origin CA certificate when someone connects directly to the origin address.

Create the certificate

  1. In Cloudflare, open the SSL/TLS area and create an Origin CA certificate covering every hostname that Cloudflare will send to the origin, such as example.com and www.example.com.

  2. Save the certificate and private key on the server with restrictive ownership and permissions. Do not paste the private key into a ticket, repository or public document.

    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.
  3. If users must connect directly to the origin, use a certificate from a publicly trusted authority instead. The choice changes the certificate trust model, not the Apache virtual-host concepts.

Configure Apache on port 443

Enable SSL if you have not already done so and add a TLS virtual host. Use the actual paths where you stored the certificate and key:

sudo a2enmod ssl headers rewrite
sudo nano /etc/apache2/sites-available/wordpress-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /srv/www/wordpress

    DirectoryIndex index.php

    <Directory /srv/www/wordpress>
        AllowOverride All
        Options FollowSymLinks
        Require all granted
    </Directory>

    SSLEngine on
    SSLCertificateFile /etc/ssl/cloudflare/example.com.pem
    SSLCertificateKeyFile /etc/ssl/cloudflare/example.com.key

    ErrorLog ${APACHE_LOG_DIR}/wordpress_ssl_error.log
    CustomLog ${APACHE_LOG_DIR}/wordpress_ssl_access.log combined
</VirtualHost>
</IfModule>

Protect the key file so only root and the process that must read it can access it. Test and enable the configuration:

sudo a2ensite wordpress-ssl.conf
sudo apachectl configtest
sudo systemctl reload apache2

Confirm that port 443 is open at the server and any upstream firewall. In Cloudflare’s SSL/TLS encryption mode, select Full (strict) only after the certificate covers the requested hostname, is valid for its dates and Apache serves it on port 443. Cloudflare’s Origin CA documentation, last updated August 14, 2026, describes this origin-encryption use case.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why does WordPress redirect in a loop after enabling Cloudflare?

A loop normally means Cloudflare connects to Apache with HTTPS while Apache or WordPress believes the original request was HTTP. A second common cause is a host-header mismatch that makes WordPress generate a different canonical domain.

Best Value
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Check the encryption mode first

Do not use Flexible mode for a site that forces HTTPS at the origin: Cloudflare receives HTTPS from the visitor but sends HTTP to Apache, which can trigger an endless redirect. Use Full while testing, then Full (strict) once the origin certificate is correctly installed.

Pass the original protocol to WordPress

Cloudflare and other reverse proxies communicate the visitor’s protocol in a forwarded header. In wp-config.php, before the line that says to stop editing, add a narrowly scoped rule for your proxy:

if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
    $_SERVER['HTTPS'] = 'on';
}

Only trust this header when requests can reach the origin through a controlled proxy path. If the origin is publicly reachable by arbitrary clients, restrict direct access or validate the proxy source before trusting forwarded headers.

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.

Keep the forwarded host and WordPress URLs consistent

A reverse proxy can alter the host header. If links point to an internal hostname, inspect the incoming host and forwarded-host values in Apache access logs and compare them with the domain configured in WordPress. Set the canonical WP_HOME and WP_SITEURL to the same HTTPS hostname when the dashboard value is wrong:

define('WP_HOME', 'https://example.com');
define('WP_SITEURL', 'https://example.com');

Do not define these constants twice or leave an old staging hostname in the database. After changing them, clear browser and proxy caches and test an incognito window. If the loop persists, temporarily disable any plugin that forces redirects and inspect Apache’s SSL and error logs.

What should you verify after the site goes live?

Use a deliberate acceptance check rather than assuming that a successful installer means the deployment is complete.

  • Both the apex and any intended www hostname resolve to the expected Cloudflare records.
  • HTTP requests reach the chosen HTTPS canonical URL exactly once, without alternating between hostnames.
  • The browser shows a valid certificate for the public hostname, and Cloudflare reports a strict encrypted connection to the origin.
  • The WordPress dashboard can create a test post, upload a small image and save a setting.
  • Permalink links work after a fresh browser request, confirming that Apache rewrite handling is active.
  • Apache logs show the expected hostname and no repeated 301 or 302 chain.
  • Database and file backups complete, and you have tested restoring at least one backup to a separate location.
  • SSH remains available independently of Cloudflare proxy changes, and administrative DNS records are not accidentally proxied as web traffic.

What are the most common installation failures and fixes?

Symptom Likely cause Fix
Apache shows its default page The WordPress virtual host is disabled, the request hostname does not match, or DNS still points elsewhere. Run sudo apachectl -S, enable the intended site, verify ServerName and ServerAlias, then check DNS.
403 Forbidden Apache cannot traverse the directory, the Directory block lacks Require all granted, or permissions are too restrictive. Check each parent directory, the virtual-host block and the Apache error log. Keep permissions narrow rather than making the tree world-writable.
PHP downloads or appears as text The PHP Apache module is missing or Apache was not restarted after installation. Verify libapache2-mod-php, check php -v, enable the module supplied by your Ubuntu release and restart Apache.
Database connection error in the installer Wrong credentials, database service stopped, or a user host value that does not match the connection. Check sudo systemctl status mariadb or the MySQL service, test the credentials locally and confirm the database grant.
Too many redirects after proxying Flexible Cloudflare mode, missing forwarded-protocol handling or conflicting hostnames. Install and validate the origin certificate, choose Full (strict), pass the original protocol safely and align WordPress’s canonical URL with the public hostname.
Cloudflare reports an origin certificate error Apache is not listening on 443, the certificate does not include the hostname, the key path is wrong or the certificate has expired. Run sudo apachectl configtest, inspect the SSL virtual host, verify file permissions and test the origin directly using the hostname.
Updates fail with permission errors File ownership does not match the PHP process or a hardened read-only policy is in effect. Review ownership and the specific directory that needs temporary write access. Avoid permanently granting broad write permissions.

How should you maintain this Ubuntu WordPress installation?

Self-hosting shifts routine responsibility to you. Apply Ubuntu security updates, monitor Apache and database services, keep PHP within WordPress’s supported range, and review WordPress core, theme and plugin updates before deploying them to a production site.

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

Back up both the database and /srv/www/wordpress, including the uploads directory and configuration files. Store at least one copy away from the server and periodically perform a restoration drill. Keep a record of the Apache virtual-host files, certificate renewal procedure, DNS settings and the database version so a replacement server can be rebuilt without guesswork.

When adding another site, give it its own virtual host, web root, database and database account. Revisit PHP-FPM process isolation if sites have different trust levels or resource requirements. Cloudflare can reduce exposure of a proxied origin, but it does not patch WordPress, secure SSH, create backups or replace server monitoring.

Frequently Asked Questions

Can I use Cloudflare Origin CA if visitors bypass Cloudflare?

Origin CA is designed for the Cloudflare-to-origin connection and is not generally trusted by browsers that connect directly to the server. If direct access is required, install a publicly trusted certificate or prevent bypass traffic at the network layer.

Should the WordPress database be on the same Ubuntu server?

The guide uses a local MariaDB or MySQL service because it is simple and keeps the database connection on localhost. A separate database host can work, but it adds network firewall rules, latency and another service to back up and monitor.

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

Can I install WordPress from Ubuntu’s APT package instead of the upstream archive?

The Ubuntu tutorial prefers the release published by WordPress.org rather than the Ubuntu Archive package. The upstream archive lets the WordPress project control the application release while Ubuntu packages continue to provide the operating-system services.

Why does the site work by IP address but not by domain name?

An IP request may select Apache’s default virtual host, while the domain request depends on DNS and the matching ServerName or ServerAlias. Verify DNS propagation, the Cloudflare record, the Apache virtual-host map and the hostname configured in WordPress.

Do I need to proxy every DNS record through Cloudflare?

No. Proxy the records that should carry web traffic through Cloudflare, and keep SSH or unrelated services separate. Cloudflare’s HTTP proxy setting does not provide a general-purpose transport for administrative protocols.

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.

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