Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk10 min

How to Install WordPress on Ubuntu With Nginx or Apache

Install WordPress on Ubuntu using Apache or Nginx. This guide covers PHP, MariaDB or MySQL, virtual hosts, PHP-FPM, HTTPS, permissions, backups and common fixes.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The reliable installation path is to prepare a supported Ubuntu web stack, create a dedicated MySQL or MariaDB database, download the current WordPress archive, configure Apache or Nginx to run PHP, enable HTTPS, and finish the setup in a browser. Apache follows Canonical’s documented Ubuntu route; Nginx works equally well but requires an explicit PHP-FPM socket and server block.

What you need before installing WordPress

Use a supported Ubuntu Server host with shell access and sudo privileges. Decide the hostname first: a public DNS name is required for a normal production certificate, while a local hostname is sufficient for a private test installation. Shell-based file transfer is simplest; FTP is optional.

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.
Component Minimum or recommended baseline Why it matters
PHP PHP 8.3 or newer is WordPress’s current recommendation Runs WordPress core, themes and plugins
Database MariaDB 10.11 or newer, or MySQL 8.0 or newer Stores posts, settings, users and metadata
Web server Apache or Nginx Serves static files and passes PHP requests to the runtime
HTTPS A valid certificate for production Protects logins, cookies and administrative traffic
Host resources Enough disk, memory and CPU for your traffic, media and plugins WordPress itself is small, but extensions and uploads can grow quickly

The PHP, database and HTTPS figures above reflect the current WordPress requirements page accessed on October 14, 2026. WordPress’s “Before You Install” guidance was updated December 17, 2025. Verify the versions actually available in your Ubuntu release rather than assuming that every release ships the same PHP branch.

Choose Apache or Nginx

Decision point Apache Nginx
Configuration model Virtual-host files and the rewrite module Server blocks with routing written directly in Nginx configuration
PHP integration Can use Ubuntu’s packaged Apache PHP integration Requires PHP-FPM and a configured Unix socket or upstream
Permalink handling WordPress can use .htaccess when overrides are allowed Uses a try_files front-controller rule in the server block
Best operational fit Administrators already familiar with Apache site files Administrators already operating Nginx and PHP-FPM

Both are robust, featureful choices supported by WordPress. There is no universal speed winner for this deployment; traffic pattern, plugins, PHP settings, caching and hardware determine real-world performance. Use the conventions already used by the rest of your server fleet.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Prepare Ubuntu and install the common packages

Log in over SSH and update the host before adding the web stack:

sudo apt update
sudo apt full-upgrade -y
sudo apt install -y curl tar unzip mariadb-server

MySQL can be used instead of MariaDB. If MySQL is already installed, keep that server and skip installing a second database daemon. Check the PHP runtime after installing the web-server-specific packages below:

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.
php -v

If the reported major and minor version is below 8.3, install a supported PHP version for your Ubuntu release before continuing. Do not proceed with an obsolete runtime merely because the command is available.

Install WordPress with Apache

1. Install Apache, PHP and WordPress extensions

Install Apache and the extensions used by the Ubuntu walkthrough. Package names can vary slightly between Ubuntu releases, so let APT report a package that is unavailable rather than substituting an old PHP branch without checking compatibility.

sudo apt install -y apache2 php libapache2-mod-php php-mysql php-curl php-imagick php-intl php-mbstring php-xml php-zip php-bcmath

Confirm the web server and PHP module are active:

sudo systemctl enable --now apache2
php -m | grep -E 'curl|imagick|intl|mbstring|mysqli|mysqlnd|xml|zip|bcmath'

2. Download the upstream WordPress archive

Use the current archive from WordPress.org instead of an outdated distribution package. The following example keeps the site under /srv/www/wordpress:

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
sudo mkdir -p /srv/www
cd /tmp
curl -LO https://wordpress.org/latest.tar.gz
sudo tar -xzf latest.tar.gz -C /srv/www
sudo chown -R root:root /srv/www/wordpress
sudo find /srv/www/wordpress -type d -exec chmod 755 {} ;
sudo find /srv/www/wordpress -type f -exec chmod 644 {} ;

Keeping the code owned by root or a controlled deployment account prevents a compromised plugin or web process from rewriting the entire application. You can grant narrowly scoped write access to wp-content/uploads later if your update policy requires it; do not make the whole tree writable by www-data without understanding the risk.

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

3. Create the Apache virtual host

Replace example.com with your real DNS name. Create /etc/apache2/sites-available/wordpress.conf:

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /srv/www/wordpress

    DirectoryIndex index.php

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

    ErrorLog ${APACHE_LOG_DIR}/wordpress-error.log
    CustomLog ${APACHE_LOG_DIR}/wordpress-access.log combined
</VirtualHost>

AllowOverride permits WordPress’s generated rewrite rules in .htaccess. If your security policy forbids per-directory overrides, replace that approach with equivalent rules in the virtual host and keep overrides disabled.

4. Enable the site and rewrite module

sudo a2ensite wordpress.conf
sudo a2enmod rewrite
sudo a2dissite 000-default.conf
sudo apache2ctl configtest
sudo systemctl reload apache2

The configuration test must return Syntax OK. If it reports a duplicate ServerName, a missing directory or an invalid directive, correct that error before reloading.

5. Create a least-privilege database and user

Open the local database administrator console:

sudo mariadb

Run SQL with a unique database name, username and long random password. The same statements work in MySQL’s client:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
CREATE DATABASE wordpress CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wp_site'@'localhost' IDENTIFIED BY 'replace-with-a-long-random-password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wp_site'@'localhost';
FLUSH PRIVILEGES;
EXIT;

The grant is limited to this site’s database. Create a separate database and account for each independent site whenever practical, particularly on a multi-tenant server. Never publish the database password in a ticket, shell history or configuration repository.

6. Complete the browser installer

Point DNS at the server, then visit the hostname in a browser. WordPress asks for:

  • Database name: wordpress in the example
  • Database username: wp_site
  • Database password: the value used in the CREATE USER statement
  • Database host: usually localhost for a database on the same machine
  • Table prefix: keep the default for one installation, or use a unique prefix when separate installations intentionally share one database

Choose a site title, administrator username, strong administrator password and email address. Avoid using admin as the administrator username. If the installer cannot write wp-config.php, copy wp-config-sample.php to wp-config.php, enter the database values and the authentication salts manually, then restore restrictive ownership and permissions.

Install WordPress with Nginx and PHP-FPM

Use the same Ubuntu preparation, archive extraction, database creation and HTTPS process as the Apache route. Only the web-server and PHP execution layer changes.

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.

1. Install Nginx, PHP-FPM and extensions

sudo apt install -y nginx php-fpm php-mysql php-curl php-imagick php-intl php-mbstring php-xml php-zip php-bcmath
sudo systemctl enable --now nginx
sudo systemctl enable --now php8.3-fpm

The service name may be php8.2-fpm, php8.4-fpm or another version supported by your Ubuntu release. Discover the installed socket instead of guessing:

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
ls -l /run/php/*fpm.sock
systemctl list-units --type=service 'php*-fpm.service'

Use the socket shown by those commands in the server block. The official Ubuntu walkthrough retrieved for this subject is Apache-specific, so verify the exact PHP-FPM package name, socket path and included-snippet syntax on the deployed Ubuntu and PHP versions.

2. Create the Nginx server block

Create /etc/nginx/sites-available/wordpress. Change the PHP-FPM socket if your system reports a different filename:

server {
    listen 80;
    listen [::]:80;
    server_name example.com www.example.com;

    root /srv/www/wordpress;
    index index.php index.html;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ .php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.3-fpm.sock;
    }

    location ~* /(?:uploads|files)/.*.php$ {
        deny all;
    }

    location ~ /.ht {
        deny all;
    }
}

The try_files directive sends unknown URLs to WordPress’s front controller while serving existing files directly. The PHP location passes only PHP requests to FPM, and the deny rules prevent hidden Apache files and uploaded PHP files from being executed.

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

3. Enable the site and test Nginx

sudo ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/wordpress
sudo rm -f /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl reload nginx

nginx -t must report a successful syntax test. A 502 Bad Gateway after reload almost always means that Nginx is pointing to a nonexistent or stopped PHP-FPM socket; compare fastcgi_pass with ls -l /run/php/*fpm.sock and restart the matching FPM service.

4. Run the WordPress installer

Browse to the configured hostname and enter the database name, account, password and host created earlier. Nginx does not use .htaccess, so keep the try_files rule in place before testing permalinks. The browser installer still writes or requests the same wp-config.php file as the Apache installation.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Enable HTTPS before production use

Do this after DNS resolves to the server and before inviting users to log in. Permit TCP ports 80 and 443 in the host firewall and any cloud firewall. Port 80 is commonly needed for certificate validation and redirects.

Apache certificate setup

Install an ACME client appropriate for your Ubuntu release, then request a certificate for every hostname users will visit. With Certbot, the Apache plugin can configure the virtual host and redirect HTTP:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo apt install -y certbot python3-certbot-apache
sudo certbot --apache -d example.com -d www.example.com

Nginx certificate setup

sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d example.com -d www.example.com

Read the proposed redirect and certificate changes before accepting them. Confirm that renewal is scheduled and perform a dry run using the ACME client’s renewal test. After HTTPS is active, check the WordPress Address and Site Address under Settings → General; both should use the final https:// hostname. Mixed-content warnings usually indicate hard-coded http:// image, stylesheet or script URLs in a theme or plugin.

Permissions and hardening decisions

  • Keep wp-config.php readable by the PHP process but not broadly writable. It contains database credentials and cryptographic salts.
  • Allow the web server to write only where necessary, normally the uploads directory and a deliberately chosen update workflow.
  • Use separate Unix users, databases and virtual hosts for unrelated sites. Shared ownership by www-data makes maintenance easier but increases the impact of a compromised site.
  • Disable unused services and restrict SSH with keys, firewall rules and regular operating-system updates.
  • Install themes and plugins only from sources you trust, and remove inactive extensions rather than leaving them exposed.
  • Back up both the database and uploaded files before WordPress, theme, plugin or PHP upgrades.

Verify the installation after first login

  1. Open the home page, an individual post, a category archive and the login page.
  2. In Settings → Permalinks, save the chosen structure once, then test a post URL in a private browser window.
  3. Upload an image larger than a thumbnail and confirm that it appears in the Media Library.
  4. Check Tools → Site Health for HTTPS, loopback, scheduled-event and PHP-extension warnings.
  5. Confirm that the server clock, DNS records and certificate names are correct.
  6. Trigger a scheduled task or publish a test post and verify that WP-Cron or your chosen system-cron arrangement runs.
  7. Record the Ubuntu, web-server, PHP, database and WordPress versions so future upgrades can be planned and rolled back.

Troubleshooting common failures

Symptom Likely cause Checks and remedy
Apache shows 403 Forbidden Incorrect directory permissions, missing Require all granted or an access rule blocking the path Check the Apache error log, verify that every parent directory is searchable, and confirm the virtual-host <Directory> block.
Nginx returns 502 Bad Gateway PHP-FPM is stopped or the socket path is wrong Run systemctl status php*-fpm, list /run/php/*fpm.sock, correct fastcgi_pass and reload Nginx.
WordPress says it cannot connect to the database Wrong database name, account, password, host or database service state Test the credentials with the database client, check systemctl status mariadb or MySQL, and ensure the account is permitted from the host shown in the grant.
Pretty permalinks return 404 Apache rewrite is disabled or Nginx lacks the front-controller rule Enable rewrite and allow the required Apache overrides, or add try_files $uri $uri/ /index.php?$args; to Nginx.
Media uploads fail or are truncated PHP upload limits, filesystem permissions or reverse-proxy limits Inspect upload_max_filesize, post_max_size and the PHP-FPM/Apache or Nginx configuration, then restart the affected service after changes.
Browser redirects repeatedly between HTTP and HTTPS Conflicting proxy headers or mismatched WordPress URL settings Use one canonical HTTPS hostname, configure trusted proxy headers when a load balancer terminates TLS, and correct both WordPress URL fields.
Updates request FTP credentials The PHP process cannot write to the selected directories Prefer a controlled deployment or narrowly scoped ownership change; do not make the entire WordPress tree world-writable.

Backups, updates and ongoing operation

A WordPress backup has two independent parts: the database and the files, especially wp-content/uploads and any custom themes or plugins. A simple database export is:

mysqldump --single-transaction --routines --triggers -u wp_site -p wordpress > wordpress-$(date +%F).sql

Store the dump away from the web root and test restoring it. For files, archive the WordPress directory or at least the uploads and custom-code directories to storage that the web server cannot serve directly. Keep multiple dated copies and encrypt off-host backups.

Apply Ubuntu security updates, the web server, PHP, database server, WordPress core, themes and plugins on a schedule. Read compatibility notes before changing PHP major or minor versions. Take a fresh backup, update one layer at a time, exercise the verification checklist and retain a rollback path. Monitor certificate renewal, disk space, error logs, failed logins and scheduled-task execution.

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

Which stack should you use?

Choose Apache when you want to follow Canonical’s documented Ubuntu walkthrough closely, rely on familiar virtual-host files or let WordPress-managed .htaccess rules handle rewrites. Choose Nginx when your fleet already standardizes on Nginx, you prefer centralized server-block routing or you are comfortable operating PHP-FPM.

Neither choice removes the important work: a current PHP runtime, a supported database, correct URL routing, least-privilege ownership, HTTPS and regular maintenance. Select the server your team can configure, monitor and recover confidently rather than choosing on an unverified performance claim.

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.

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.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

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.