{"id":7008,"date":"2025-08-26T10:00:19","date_gmt":"2025-08-26T10:00:19","guid":{"rendered":"https:\/\/blog.ssdnodes.com\/blog\/?p=7008"},"modified":"2025-08-26T11:00:52","modified_gmt":"2025-08-26T11:00:52","slug":"how-to-install-wordpress-with-lemp-and-mariadb-on-ubuntu","status":"publish","type":"post","link":"https:\/\/www.ssdnodes.com\/blog\/how-to-install-wordpress-with-lemp-and-mariadb-on-ubuntu\/","title":{"rendered":"How to Install WordPress with LEMP and MariaDB on Ubuntu 24.04"},"content":{"rendered":"<p>Do you want to get WordPress with LEMP and MariaDB running on your Ubuntu server in no time? Well, you can do so with this detailed tutorial.<\/p>\n<h2>Installing WordPress with LEMP and MariaDB on Ubuntu<\/h2>\n<p>To install WordPress with LEMP and MariaDB on Ubuntu, you will set up a WordPress MariaDB database, install the required PHP packages, download WordPress, configure the web server and MariaDB database, and then complete the installation through the WordPress web interface.<\/p>\n<h3>Note<\/h3>\n<p>If you want to skip all the technical steps of setting up WordPress on your server and have it installed in minutes, then I have some great news for you! Our team of engineers has prepared a ready-to-use 1-click WordPress application for your convenience. Just choose a <a href=\"https:\/\/www.ssdnodes.com\/\">server<\/a>, and while prompted to choose the operating system, choose <strong>WordPress<\/strong> from the dropdown menu. This will set up WordPress in minutes!<\/p>\n<h2>Prerequisites for Installing WordPress with LEMP and MariaDB<\/h2>\n<p>To install WordPress with the LEMP stack and MariaDB database, you need the following:<\/p>\n<ul>\n<li>An Ubuntu 24.04 server. We offer the <a href=\"https:\/\/www.ssdnodes.com\/\">globe's absolute lowest cost Ubuntu servers<\/a>!<\/li>\n<li>Root access to your server or a <code>sudo<\/code> user. Check out our <a href=\"https:\/\/www.ssdnodes.com\/blog\/tutorial-setting-up-and-securing-ssh-based-authentication\/\">How to access your server using SSH<\/a> guide to learn how to access your server and create a <code>sudo<\/code> user.<\/li>\n<li>The LEMP stack installed on your server. Use our <a href=\"https:\/\/www.ssdnodes.com\/blog\/installing-lemp-on-ubuntu-22-04-lts-jammy-jellyfish\/\">Installing LEMP on Ubuntu 22.04 LTS<\/a> guide to set it up. Or you can use our LEMP <a href=\"https:\/\/www.ssdnodes.com\/\">1-Click Application<\/a> to get started in minutes! Just choose a server, and while prompted to choose the operating system, choose <strong>LEMP<\/strong> from the dropdown menu.<\/li>\n<\/ul>\n<h2>Step 1 - Updating the Package Cache<\/h2>\n<p>Before you install WordPress with LEMP and MariaDB, you need to update your Ubuntu packages in the package manager cache to the latest available versions using the following command:<\/p>\n<pre><code>sudo apt update<\/code><\/pre>\n<h2>Step 2 - Creating a WordPress MariaDB Database and User<\/h2>\n<p>WordPress needs a MySQL database to store your site's data, such as user information, posts, pages, etc. In this tutorial we'll use MariaDB, which is a compatible drop-in replacement for MySQL but with more features.<\/p>\n<p>To create a MySQL\/MariaDB database, use the <code>mysql<\/code> client to connect to MariaDB and access its command line interface with the following command:<\/p>\n<pre><code>sudo mysql<\/code><\/pre>\n<p>If you get an error that contains <code>Access denied for user 'root'<\/code>, this means that the default authentication method has changed, and connecting to MariaDB requires a password for the root account. To solve this issue, use the following command to connect to MariaDB using the root user and a password:<\/p>\n<pre><code>mysql -u root -p<\/code><\/pre>\n<p>You'll be asked for your MySQL root password, enter it and then press <strong>Enter<\/strong>.<\/p>\n<p><strong>Note:<\/strong> If you've installed the LEMP stack using our 1-Click App, you'll find your MySQL root password in the <strong>App Details<\/strong> widget on your SSDNodes Dashboard. As demonstrated in the following image:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9654\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/info.webp\" alt=\"Install WordPress with LEMP and MariaDB on Ubuntu \" width=\"600\" height=\"574\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/info.webp 746w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/info-300x287.webp 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>You should get a prompt similar to the following:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9655\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/mariadb-prompt.webp\" alt=\"WordPress with LEMP and MariaDB\" width=\"600\" height=\"259\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/mariadb-prompt.webp 800w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/mariadb-prompt-300x129.webp 300w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/mariadb-prompt-768x331.webp 768w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>Now you can create a database for WordPress. We'll name the database <code>wordpress<\/code>, but feel free to use your site's name, or any other name you would like, just make sure to remember it. Use the following MySQL statement to create a database named <code>wordpress<\/code>:<\/p>\n<pre><code>CREATE DATABASE <mark>wordpress<\/mark> DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;<\/code><\/pre>\n<p>This creates a database called <code>wordpress<\/code> with UTF-8 as a character set, which supports all alphabets and languages.<\/p>\n<p>If you receive an error upon entering the preceding command, make sure you've typed it in correctly, and that you end it with a semicolon (<code>;<\/code>).<\/p>\n<p>Next, you'll need to create a MariaDB user account that will manage this <code>wordpress<\/code> database. Only this one account can interact with the site's database, which is a good security best practice. For this new user, we'll use the name <code>wp_user<\/code>, but again, feel free to use another name of your choice.<\/p>\n<p>To create a new MariaDB user account, use the following statement in the MariaDB command line interface. Remember to replace <code>password<\/code> with a strong password for your user account, or you might wake up some day to the news of your WordPress website transforming into an abnormal nightmare:<\/p>\n<pre><code>CREATE USER '<mark>wp_user<\/mark>'@'localhost' IDENTIFIED BY 'password';<\/code><\/pre>\n<p>Now, you'll need to give all access permissions to the user account that will manage your <code>wordpress<\/code> database:<\/p>\n<pre><code>GRANT ALL ON wordpress.* TO '<mark>wp_user<\/mark>'@'localhost';<\/code><\/pre>\n<p>Here, you use the <code>GRANT ALL<\/code> statement to grant all privileges on the <code>wordpress<\/code> database to your <code>wp_user<\/code> user.<\/p>\n<p>Refresh the privileges for the preceding command to take effect and apply the permission changes to the database server:<\/p>\n<pre><code>FLUSH PRIVILEGES;<\/code><\/pre>\n<p>Exit out of the MariaDB command line interface and return to the regular Linux shell with the following command:<\/p>\n<pre><code>EXIT;\r\n<\/code><\/pre>\n<p>With this, you have a MariaDB database and a MariaDB user account that can be used by your WordPress website to store data. Next, you'll install some important PHP packages that WordPress needs to function properly.<\/p>\n<h2>Step 3 - Installing Required PHP Extensions for WordPress<\/h2>\n<p>WordPress requires a few additional PHP packages to be installed, in addition to the PHP packages that were installed with the LEMP stack. In this step, you'll use the <code>apt<\/code> command to install the most important PHP extensions that WordPress uses.<\/p>\n<p><strong>Note:<\/strong> The PHP packages we'll install are required for basic WordPress usage, but many WordPress plugins that extend the basic functionalities of WordPress come with their own requirements, and may require additional PHP extension packages to be installed. Refer to the documentation of the specific plugin you want to install to find out its required packages and install them with <code>apt<\/code> using the method we'll demonstrate in this step.<\/p>\n<p>To install the most important PHP extensions for WordPress, run the following command:<\/p>\n<pre><code>sudo apt install php-curl php-gd php-intl php-mbstring php-soap php-xml php-xmlrpc php-zip php-imagick<\/code><\/pre>\n<p>Here, you install the following packages:<\/p>\n<ul>\n<li><code>php-curl<\/code>: Provides a CURL module for PHP. CURL is used in command lines and scripts to transfer data through URLs.<\/li>\n<li><code>php-gd<\/code>: Provides a GD module for PHP. The GD library is a library that offers graphics drawing tools to manage image data.<\/li>\n<li><code>php-intl<\/code>: Provides an Internationalisation module for PHP.<\/li>\n<li><code>php-mbstring<\/code>: A package that provides the MBSTRING module for PHP, which is used to manage non-ASCII strings.<\/li>\n<li><code>php-soap<\/code>: Provides the SOAP module for PHP. SOAP is an API architecture that uses the XML language to transfer data between software. Although it has been replaced by the more flexible REST architecture in most web services, SOAP is still used by some companies.<\/li>\n<li><code>php-xml<\/code>: A package that provides a DOM, SimpleXML, WDDX, XML, and XSL module for PHP.<\/li>\n<li><code>php-xmlrpc<\/code>: Provides a XMLRPC-EPI module for PHP. XML-RPC is a feature of WordPress that enables data to be transmitted via HTTP using XML for encoding.<\/li>\n<li><code>php-zip<\/code>: Provides a Zip module for PHP. Zip is a tool that is used to archive and compress files.<\/li>\n<li><code>php-imagick<\/code>: Imagick is a native php extension to create and modify images using the ImageMagick API.<\/li>\n<\/ul>\n<p>Once the installation is complete, restart the <code>php-fpm<\/code> process for it to use the newly installed PHP extensions:<\/p>\n<pre><code>sudo systemctl restart php8.1-fpm.service<\/code><\/pre>\n<p><strong>Note:<\/strong> You may have another version of <code>php-fpm<\/code> installed on your system, so you might have to change <code>8.1<\/code> in the preceding command with your version of PHP. To check your <code>php-fpm<\/code> version, use the following command:<\/p>\n<pre><code>sudo systemctl status php* | grep fpm.service<\/code><\/pre>\n<p>You should receive the full name and version of your <code>php-fpm<\/code> service:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9656\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/php8.1.webp\" alt=\"Installing PHP for WordPress with LEMP and MariaDB on Ubuntu \" width=\"600\" height=\"175\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/php8.1.webp 800w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/php8.1-300x87.webp 300w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/php8.1-768x224.webp 768w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>With this, the required PHP extensions are now installed. Next, you'll configure Nginx to serve WordPress.<\/p>\n<h2>Step 4 - Configuring Nginx to Serve WordPress<\/h2>\n<p>Now that our WordPress database and the PHP extensions are ready, we'll configure the Nginx web server to serve the pages and posts of our website. We'll create a new root web directory for WordPress files, and use a new Nginx configuration file made specifically for the website.<\/p>\n<p>First check Nginx\u2019s status with the following command:<\/p>\n<pre><code>sudo systemctl status nginx<\/code><\/pre>\n<p>The output should show that the Nginx service is enabled and running:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9657\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/sudo-systemctl-status-nginx.webp\" alt=\"WordPress with MariaDB on Ubuntu: Nginx Status\" width=\"600\" height=\"426\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/sudo-systemctl-status-nginx.webp 800w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/sudo-systemctl-status-nginx-300x213.webp 300w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/sudo-systemctl-status-nginx-768x545.webp 768w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>By default, Nginx is configured to serve files out of a root web directory located at <code>\/var\/www\/html<\/code>. This default configuration is suitable for small single-site web servers. However, hosting multiple sites using this method will quickly become unmanageable and cumbersome. Instead, it is best to create a root web directory for each site you\u2019d like to host on your web server. In this tutorial, we will create a root web directory for our WordPress website located at <code>\/var\/www\/wordpress<\/code>. Again, feel free to use your site's name or some other name instead of <code>wordpress<\/code> for this root web directory, just remember to use the correct path in your Nginx configuration.<\/p>\n<p>Use the following command to create a root web directory for your WordPress site, replacing <code>wordpress<\/code> with your site\u2019s name if you want:<\/p>\n<pre><code>sudo mkdir \/var\/www\/<mark>wordpress<\/mark><\/code><\/pre>\n<p>Next, open a new configuration file in Nginx\u2019s <code>sites-available<\/code> directory, which is a directory that contains configuration for each of your sites. Again, make sure to replace <code>wordpress<\/code> with your name of choice:<\/p>\n<pre><code>sudo nano \/etc\/nginx\/sites-available\/<mark>wordpress<\/mark><\/code><\/pre>\n<p>Paste into it the following:<\/p>\n<pre><code>server {\r\n    listen 80;\r\n    listen [::]:80;\r\n    server_name &lt;<mark>domain_name_or_IP<\/mark>&gt;;\r\n    access_log off;\r\n    location \/ {\r\n        rewrite ^ https:\/\/$host$request_uri? permanent;\r\n    }\r\n}\r\n\r\nserver {\r\n    listen 443 ssl;\r\n    listen [::]:443 ssl;\r\n    server_name &lt;<mark>domain_name_or_IP<\/mark>&gt;;\r\n    root \/var\/www\/<mark>wordpress<\/mark>;\r\n    index index.php index.html index.htm index.nginx-debian.html;\r\n    autoindex off;\r\n    ssl_certificate \/etc\/ssl\/certs\/lemp.pem;\r\n    ssl_certificate_key \/etc\/ssl\/private\/lemp.key;\r\n    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;\r\n    ssl_ciphers HIGH:!aNULL:!MD5;\r\n\r\n    location ~ \\.php$ {\r\n         include snippets\/fastcgi-php.conf;\r\n         fastcgi_pass unix:\/var\/run\/php\/php-fpm.sock;\r\n         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\r\n         include fastcgi_params;\r\n    }\r\n\r\n    location \/ {\r\n        try_files $uri $uri\/ \/index.php$is_args$args;\r\n    }\r\n    location = \/favicon.ico { log_not_found off; access_log off; }\r\n    location = \/robots.txt { log_not_found off; access_log off; allow all; }\r\n    location ~* \\.(css|gif|ico|jpeg|jpg|js|png)$ {\r\n        expires max;\r\n        log_not_found off;\r\n    }\r\n}<\/code><\/pre>\n<p>Here, you have two server blocks representing configuration for two ports: port 80 which serves HTTP requests, and port 443 that serves HTTPS requests.<\/p>\n<p>Notice that, in the HTTP configuration, you use the rewrite directive in the location block to redirect HTTP requests to HTTPS.<\/p>\n<p>In the preceding configuration file, you set up the following:<\/p>\n<ul>\n<li><code>listen<\/code>: The port number Nginx will listen on. Here, you set its value to <code>80<\/code> in the HTTP server block, which is the port number assigned to HTTP. And you set it to <code>443<\/code> in the HTTPS server block, which is the port number for HTTPS.<\/li>\n<li><code>server_name<\/code>: The domain names or IP addresses these two server block configurations should respond for. Make sure to replace `` with your domain name or IP address.<\/li>\n<li><code>access_log<\/code>: Configures Nginx access logs, the special value <code>off<\/code> cancels all <code>access_log<\/code> directives on the current level.<\/li>\n<li><code>root<\/code>: The root web directory, also known as the document root, that stores the files served by your website. Here, you set its value to <code>\/var\/www\/wordpress<\/code>, which is the root web directory we created earlier, so make sure to set the proper value in your case.<\/li>\n<li><code>index<\/code>: The order in which Nginx will prioritize index files for your website.<\/li>\n<li><code>autoindex<\/code>: Configures Nginx auto indexing to enable or disable the ability to browse your files from the web browser. We set it to <code>off<\/code> to disable auto indexing.<\/li>\n<li><code>ssl_certificate<\/code>: The SSL certificate file path. See <a href=\"https:\/\/www.ssdnodes.com\/blog\/install-lets-encrypt-on-ubuntu-certbot-apache-and-nginx\/\">Secure Your Site Using HTTPS<\/a> for more information.<\/li>\n<li><code>ssl_certificate_key<\/code>: The path of your SSL certificate's private key file.<\/li>\n<li><code>ssl_protocols<\/code>: The protocols that will be used by SSL.<\/li>\n<li><code>ssl_ciphers<\/code>: The ciphers that will be used by SSL.<\/li>\n<li><code>location ~ \\.php$<\/code>: A location block that handles PHP processing. It tells Nginx to handle any HTTP request with a URL that ends with <code>.php<\/code> with the directives included in this location block. This effectively points Nginx to the <code>fastcgi-php.conf<\/code> configuration file and the <code>php-fpm.sock<\/code> file, which declares the socket that is associated with <code>php-fpm<\/code>.<\/li>\n<li><code>location \/<\/code>: The main location block, which includes a <code>try_files<\/code> directive, and it allows Nginx to route HTTP requests to the WordPress <code>index.php<\/code> file.<\/li>\n<li><code>location = \/favicon.ico<\/code>: A location block for requests to <code>\/favicon.ico<\/code>. Which you configure to disable logging for the <code>favicon.ico<\/code> file.<\/li>\n<li><code>location = \/robots.txt<\/code>: A location block for requests to <code>\/robots.txt<\/code>. Which you configure to disable logging for the <code>\/robots.txt<\/code> file.<\/li>\n<li><code>location ~* \\.(css|gif|ico|jpeg|jpg|js|png)$<\/code>: A location block to configure static files to be cached with the maximum value, which sets the browser cache expiration time in the far future. This is important because these static files are expensive resources to serve.<\/li>\n<\/ul>\n<p>Next, you'll need to activate this Nginx server block configuration by linking your <code>wordpress<\/code> configuration file to the configuration file in Nginx\u2019s <code>sites-enabled<\/code> directory using the following command:<\/p>\n<pre><code>sudo ln -s \/etc\/nginx\/sites-available\/<mark>wordpress<\/mark> \/etc\/nginx\/sites-enabled<\/code><\/pre>\n<p>To check that your configuration file has been properly linked to Nginx\u2019s <code>sites-enabled<\/code> directory, run the following command:<\/p>\n<pre><code>sudo ls -l \/etc\/nginx\/sites-enabled<\/code><\/pre>\n<p>You should receive an output that\u2019s similar to the following:<\/p>\n<pre><code>total 0\r\nlrwxrwxrwx 1 root root 34 Aug 13 14:06 default -&gt; \/etc\/nginx\/sites-available\/default\r\nlrwxrwxrwx 1 root root 36 Aug 14 10:17 wordpress -&gt; \/etc\/nginx\/sites-available\/wordpress<\/code><\/pre>\n<p>Here, you can see that your <code>\/etc\/nginx\/sites-available\/wordpress<\/code> configuration file has been successfully linked.<\/p>\n<p>Next, unlink the default Nginx configuration from the <code>\/sites-enabled\/<\/code> directory. This forces Nginx to use your <code>wordpress<\/code> configuration instead of the default configuration:<\/p>\n<pre><code>sudo unlink \/etc\/nginx\/sites-enabled\/default<\/code><\/pre>\n<p>To check that the default Nginx configuration has been properly unlinked from the <code>sites-enabled<\/code> directory, run the following command:<\/p>\n<pre><code>sudo ls -l \/etc\/nginx\/sites-enabled<\/code><\/pre>\n<p>You should receive an output that\u2019s similar to the following:<\/p>\n<pre><code>total 0\r\nlrwxrwxrwx 1 root root 36 Aug 14 10:17 wordpress -&gt; \/etc\/nginx\/sites-available\/wordpress<\/code><\/pre>\n<p>Here, you can see that the default configuration symlink is no longer in the sites-enabled directory, which means that it has been successfully unlinked.<\/p>\n<p>Next, test your configuration\u2019s syntax using the following command:<\/p>\n<pre><code>sudo nginx -t<\/code><\/pre>\n<p>You should receive an output that\u2019s similar to the following:<\/p>\n<pre><code>nginx: the configuration file \/etc\/nginx\/nginx.conf syntax is ok\r\nnginx: configuration file \/etc\/nginx\/nginx.conf test is successful<\/code><\/pre>\n<p>This output shows that there are no errors in the configuration file.<\/p>\n<p>If you receive any errors, review your configuration file and make sure you\u2019ve set your directives and values properly.<\/p>\n<p>Next, reload Nginx for the changes you\u2019ve made to take effect by running the following command:<\/p>\n<pre><code>sudo systemctl reload nginx<\/code><\/pre>\n<p>You now have Nginx configured to serve files from the <code>\/var\/www\/wordpress<\/code> root web directory. Let's test the configuration using a test HTML file:<\/p>\n<pre><code>sudo nano \/var\/www\/<mark>wordpress<\/mark>\/test.html<\/code><\/pre>\n<p>Add the following HTML code to it:<\/p>\n<pre><code>&lt;!DOCTYPE html&gt;\r\n&lt;html lang=\"en\"&gt;\r\n&lt;head&gt;\r\n    &lt;meta charset=\"UTF-8\"&gt;\r\n    &lt;title&gt;Wordpress on LEMP Test Page&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;h1&gt;Test Page for WordPress Nginx Configuration&lt;\/h1&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<p>Save and close the file.<\/p>\n<p>Use your browser to navigate to this <code>test.html<\/code> file:<\/p>\n<pre><code>https:\/\/&lt;<mark>domain_name_or_IP<\/mark>&gt;\/test.html<\/code><\/pre>\n<p>As always, replace <code>&lt;<mark>domain_name_or_IP<\/mark>&gt;<\/code>\u00a0with your domain name or IP address.<\/p>\n<p>If you haven't set up an SSL certificate from a Certificate Authority like Let's Encrypt, you will receive a \"Not Secure\" error informing you that the connection to your server is not secure. This error message is normal because your website is encrypted and secured with a self-signed certificate, and the browser does not recognize it since your server is not one of its known certificate authorities.<\/p>\n<p>Click the <strong>Advanced<\/strong> button or <strong>More information<\/strong> depending on the browser, and choose to proceed. The following is an example of the error in the Google Chrome browser:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/06\/Securing-your-site-with-Self-Signed-or-CA-certificates_03.png\" alt=\"WordPress with MariaDB: HTTPS \" width=\"864\" height=\"475\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/06\/Securing-your-site-with-Self-Signed-or-CA-certificates_04.png\" alt=\"HTTPS for WordPress &amp; MariaDB on Ubuntu \" width=\"933\" height=\"634\" \/><\/p>\n<p>Once you proceed, you'll receive the message <code>Test Page for WordPress Nginx Configuration<\/code>. Which means that the Nginx configuration is correct.<\/p>\n<p>To secure your WordPress website using a valid SSL certificate, check out the <strong>Creating and Installing a CA Certificate<\/strong> section of our <a href=\"https:\/\/www.ssdnodes.com\/blog\/secure-your-site-using-https-with-self-signed-or-ca-ssl-certificates-on-ubuntu-22-04\/\">Secure Your Site Using HTTPS with Self-Signed or CA SSL Certificates on Ubuntu<\/a> article.<\/p>\n<p>You now have Nginx configured and tested, and you can now download and install the WordPress files on your server and serve them with Nginx, which is what we'll do in the next step.<\/p>\n<h2>Step 5 - Downloading WordPress and Setting up its Configuration File<\/h2>\n<p>You've created a database for your WordPress site, installed the required PHP extensions, and configured Nginx. Now, you are ready to download WordPress files and set them up in your root web directory.<\/p>\n<p>First go to your <code>\/tmp<\/code> temporary directory, in which you'll download the WordPress release compressed in a <code>tar.gz<\/code> archive:<\/p>\n<pre><code>cd \/tmp<\/code><\/pre>\n<p>Next, use <code>wget<\/code> to download the latest WordPress release using the following command:<\/p>\n<pre><code>wget https:\/\/wordpress.org\/latest.tar.gz<\/code><\/pre>\n<p>Once the download finishes, use the <code>tar<\/code> command line tool to extract the package:<\/p>\n<pre><code>tar -xzvf latest.tar.gz<\/code><\/pre>\n<p>Check that a new <code>wordpress<\/code> folder is in your <code>\/tmp<\/code> directory and display its contents with <code>ls<\/code>:<\/p>\n<pre><code>ls \/tmp\/wordpress<\/code><\/pre>\n<p>You should see a list of files. These files represent the source code of WordPress.<\/p>\n<p>The WordPress documentation recommends that you rename the <code>wp-config-sample.php<\/code> sample configuration file into <code>wp-config.php<\/code>, which is the file name WordPress uses for configuration. Use the following command to copy the <code>wp-config-sample.php<\/code> file into a file called <code>wp-config.php<\/code> to be used by WordPress:<\/p>\n<pre><code>cp \/tmp\/wordpress\/wp-config-sample.php \/tmp\/wordpress\/wp-config.php<\/code><\/pre>\n<p>Next, copy the contents of this <code>wordpress<\/code> directory into your <code>\/var\/www\/wordpress<\/code> root web directory using the following command:<\/p>\n<pre><code>sudo cp -a \/tmp\/wordpress\/. \/var\/www\/<mark>wordpress<\/mark><\/code><\/pre>\n<p>Now check the contents of your <code>\/var\/www\/wordpress<\/code> root web directory:<\/p>\n<pre><code>sudo ls -l \/var\/www\/wordpress<\/code><\/pre>\n<p>You should receive an output similar to the following:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9658\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/root-web-directory.webp\" alt=\"WordPress files. LEMP and MariaDB on Ubuntu \" width=\"600\" height=\"426\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/root-web-directory.webp 800w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/root-web-directory-300x213.webp 300w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/root-web-directory-768x545.webp 768w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>Nginx will need permissions to modify the <code>\/var\/www\/wordpress<\/code> directory, so you'll need to assign its ownership to the <code>www-data<\/code> user and group, which is the user and group that Nginx uses. Run the following command to assign the root web directory to Nginx's user and group:<\/p>\n<pre><code>sudo chown -R www-data:www-data \/var\/www\/<mark>wordpress<\/mark><\/code><\/pre>\n<p>With this, WordPress code is in your root web directory, and Nginx has permission to modify it in order to serve and update it.<\/p>\n<h3>Configuring WordPress with MariaDB<\/h3>\n<p>Next, you'll need to set up some WordPress configurations for your site to function properly.<\/p>\n<p>First, set up secret keys required for WordPress to enhance security. You can generate the required secret keys using an online service that WordPress provides. Use the following command to get random and secure secret keys from the WordPress API:<\/p>\n<pre><code>curl -s https:\/\/api.wordpress.org\/secret-key\/1.1\/salt\/<\/code><\/pre>\n<p>You'll get random values similar to the following:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/secret_keys.png\" alt=\"Wordpress Secret Keys\" \/><\/p>\n<p>You can copy the keys you get and paste them into your <code>wp-config.php<\/code> configuration file.<\/p>\n<p><strong>Note:<\/strong> Do not share your unique secret keys with anyone!<\/p>\n<p>Copy the keys you receive and open the <code>wp-config.php<\/code> configuration file:<\/p>\n<pre><code>sudo nano \/var\/www\/wordpress\/wp-config.php<\/code><\/pre>\n<p>Find the following section:<\/p>\n<pre><code>define('AUTH_KEY',         'put your unique phrase here');\r\ndefine('SECURE_AUTH_KEY',  'put your unique phrase here');\r\ndefine('LOGGED_IN_KEY',    'put your unique phrase here');\r\ndefine('NONCE_KEY',        'put your unique phrase here');\r\ndefine('AUTH_SALT',        'put your unique phrase here');\r\ndefine('SECURE_AUTH_SALT', 'put your unique phrase here');\r\ndefine('LOGGED_IN_SALT',   'put your unique phrase here');\r\ndefine('NONCE_SALT',       'put your unique phrase here');<\/code><\/pre>\n<p>And replace the values with your unique secret keys.<\/p>\n<p>Next, configure WordPress to use the database you created earlier. Look for the following lines in your configuration file, and set the proper values to them:<\/p>\n<pre><code>define( 'DB_NAME', '<mark>wordpress<\/mark>' );\r\n\r\n\/** MySQL database username *\/\r\ndefine( 'DB_USER', '<mark>wp_user<\/mark>' );\r\n\r\n\/** MySQL database password *\/\r\ndefine( 'DB_PASSWORD', '<mark>password<\/mark>' );\r\n<\/code><\/pre>\n<p>Here you set the following configuration values:<\/p>\n<ul>\n<li><code>DB_NAME<\/code>: The database name you created in Step 2.<\/li>\n<li><code>DB_USER<\/code>: The database user name.<\/li>\n<li><code>DB_PASSWORD<\/code>: The database password.<\/li>\n<\/ul>\n<p>Next, to allow Nginx to write files to your WordPress website, add the following line to <code>wp-config.php<\/code>. This forces WordPress to use direct file IO requests from within PHP. Make sure to add it <strong>before<\/strong> the line that instructs you to stop editing the configuration:<\/p>\n<pre><code>define( 'FS_METHOD', 'direct' );\r\n\/* That's all, stop editing! Happy publishing. *\/<\/code><\/pre>\n<p>Save and close the file.<\/p>\n<p>You now have the required WordPress configuration. Next, we'll perform one last thing to finish up our WordPress installation journey, where you'll use the web interface that comes with WordPress to set up your website.<\/p>\n<h2>Step 6 - Finishing up Your WordPress &amp; MariaDB Installation<\/h2>\n<p>You've created a MariaDB database, installed the required PHP extensions, configured the Nginx web server to serve your website, and configured your WordPress website through the <code>wp-config.php<\/code> file. It is now time to finish the installation through the WordPress web interface.<\/p>\n<p>First, navigate to your website using your browser:<\/p>\n<pre><code>https:\/\/&lt;<mark>domain_name_or_IP<\/mark>&gt;\/<\/code><\/pre>\n<p>You'll receive a web form asking you to choose your WordPress site's language:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/select_language.png\" alt=\"Wordpress MariaDB setup\" width=\"1012\" height=\"804\" \/><\/p>\n<p>Next, you'll be asked to set a title for your website, a user name, a password, your email address, and search engine visibility. Set your preferred values and click <strong>Install WordPress<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/Wordpress_installation.png\" alt=\"Wordpress on Ubuntu Welcome Page\" width=\"740\" height=\"807\" \/><\/p>\n<p><strong>Note:<\/strong> For security reasons, it is recommended to choose a hard to guess username. Avoid using your first name or common names such as <code>admin<\/code> or <code>administrator<\/code>.<\/p>\n<p>You'll be redirected to a page notifying you that the installation was successful, and asking you to login using the username and password you've set.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/success.png\" alt=\"Wordpress Installation Success\" width=\"830\" height=\"446\" \/><\/p>\n<p>Logging in will take you to the WordPress dashboard:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2022\/08\/dashboard.png\" alt=\"WordPress Dashboard\" width=\"1583\" height=\"799\" \/><\/p>\n<p>Now visit your site with your web browser:<\/p>\n<pre><code>https:\/\/&lt;<mark>domain_name_or_IP<\/mark>&gt;\/<\/code><\/pre>\n<p>Your website is now officially online!<\/p>\n<h2>Congrats<\/h2>\n<p>You now have your very own place on the Internet! You can use your WordPress website to create a blog, an online shop, or an online gallery to show your amazing art, or whatever else you'd like!<\/p>\n<p>Explore the WordPress dashboard to learn more about what you can do. For example, go to <code>Appearance &gt; Themes<\/code> to select a new theme for your website.<\/p>\n<h2>Important Note<\/h2>\n<p><strong>What we\u2019ve done in this article is suitable for testing purposes and personal use, whereas if you want to publish your site to production, and securely process your customers\u2019 online transactions, we do suggest you check our <a href=\"https:\/\/www.ssdnodes.com\/blog\/secure-your-site-using-https-with-self-signed-or-ca-ssl-certificates-on-ubuntu-22-04\/\">Secure Your Site Using HTTPS with Self-Signed or CA SSL Certificates on Ubuntu<\/a> blog article.<\/strong><\/p>\n<h2>Reader Alert!<\/h2>\n<p>If you feel that the technical instructions in this tutorial are time-consuming, or beyond your expertise, you can choose a very convenient and practical solution, ready-made, fully and professionally tested, and developed by SSD Nodes (That is us \ud83d\ude0a). Just visit <a href=\"https:\/\/www.ssdnodes.com\/\">our website<\/a>, choose the server\u2019s specifications that fit your needs, and while prompted to choose among the operating systems and the 1-Click Applications we have, choose <strong>WordPress<\/strong>\u00a0from the dropdown menu, complete your checkout, and in a couple of minutes our algorithms will take care of all the technical aspects smoothly and effortlessly, just for you!<\/p>\n<p><strong>Bonus:<\/strong> All our 1-Click applications are now installed with an active HTTPS self-signed certificate!<\/p>\n<p><strong>Way more practical, smooth, and headacheless, isn\u2019t it?<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Unlock the Power of WordPress: Your Comprehensive Guide to Installing WordPress on Ubuntu 24.04 with LEMP Stack and MariaDB \u2013 Fast, Secure, and Seamless!<\/p>\n","protected":false},"author":19,"featured_media":9882,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[18,30],"tags":[197,198,196],"class_list":["post-7008","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","category-tutorials","tag-lemp","tag-mariadb","tag-wordpress"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/7008","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/comments?post=7008"}],"version-history":[{"count":12,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/7008\/revisions"}],"predecessor-version":[{"id":13502,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/7008\/revisions\/13502"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/media\/9882"}],"wp:attachment":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/media?parent=7008"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/categories?post=7008"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/tags?post=7008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}