[email protected]Support 24/7 · Billing 09:00 – 00:00LinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedSeptember 11, 2023

Install WordPress with Apache on CentOS 7.

How To Install WordPress With Apache On CentOS 7.

In this tutorial, we will explain how to install WordPress on CentOS 7. At the time of writing this article, the latest version of WordPress is version 5.0.3.

WordPress is the most popular open-source blogging and CMS platform worldwide, powering a quarter of all websites on the Internet today. It is based on PHP and MySQL and packs a ton of features that can be extended with free and premium plugins and themes. WordPress is the simplest way to create your online store, website, or blog.

 

Creating MySQL Database

WordPress stores its data and configuration in a MySQL database. If you already don’t have MySQL or MariaDB installed on your CentOS server you can install by following one of the guides below:

  • Install MySQL on CentOS 7 .

  • Install MariaDB on CentOS 7 .

Login to the MySQL shell by executing the following command:

mysql -u root -p

From within the MySQL shell, run the following SQL statement to create a new database named wordpress:

CREATE DATABASE wordpress CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

Next, create a MySQL user account named wordpressuser and grant the necessary permissions to the user by running the following command:

GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'change-with-strong-password';

Once done, exit the mysql console by typing:

EXIT;

 

Downloading WordPress

The following command will download the latest version of WordPress from the WordPress download page with wget and extract the archive to the domain’s document root directory:

wget -q -O - "http://wordpress.org/latest.tar.gz" | sudo tar -xzf - -C /var/www/html --transform s/wordpress/example.com/

Set the correct permissions so that the web server can have full access to the site’s files and directories:

sudo chown -R apache: /var/www/html/example.com

 

Configuring Apache

By now, you should already have Apache with SSL certificate installed on your system, if not check the prerequisites for this tutorial.

Open your text editor and edit the domain’s Apache virtual hosts configuration :

sudo nano /etc/httpd/conf.d/example.com.conf

Don’t forget to replace example.com with your WordPress domain and set the correct path to the SSL certificate files.

<VirtualHost *:80>
  ServerName example.com
  ServerAlias www.example.com

  Redirect permanent / https://example.com/
</VirtualHost>

<VirtualHost *:443>
  ServerName example.com
  ServerAlias www.example.com

  <If "%{HTTP_HOST} == 'www.example.com'">
    Redirect permanent / https://example.com/
  </If>

  DirectoryIndex index.html index.php
  DocumentRoot /var/www/html/example.com

  ErrorLog /var/log/httpd/example.com-error.log
  CustomLog /var/log/httpd/example.com-access.log combined

  SSLEngine On
  SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
  SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem

  <Directory /var/www/html/example.com>
      Options FollowSymLinks
      AllowOverride All
      Require all granted
  </Directory>

</VirtualHost>

The configuration will tell Apache to redirects HTTP to HTTPS and www to non-www version of your domain.

Restart the Apache service for the changes to take effect:

sudo systemctl restart httpd

 

Completing the WordPress Installation

Now that WordPress is downloaded and the Apache server is configured, you can finish the installation through the web interface.

In the next step, you’ll need to enter a name for your WordPress site and choose a username (for security purposes do not use “admin” ).

The installer will automatically generate a strong password for you. Do not forget to save this password. You can also set the password by yourself.

Enter your email address and select whether you want to discourage search engines from indexing the site (not recommended).

Click Install WordPress and once the installation is completed you will be taken to a page informing you that WordPress has been installed.

To access your WordPress login page click on the Log in button.

Enter your username and password.

You will be redirected to the WordPress administration dashboard.

From here, you can start customizing your WordPress installation by installing new themes and plugins.

 

Conclusion

Congratulations, you have successfully installed WordPress with Apache on your CentOS 7 server. First Steps With WordPress is a good starting place to learn more about how to get started with WordPress.

Keep reading
How to use AWK command in linux .
March 5, 2023

How to use AWK command in linux .

How To Use AWK Commanda In Linux This article covers the essentials of the awk programming language. Knowing the basics of awk will significantly improve your ability to manipulate text files on the command line. Awk is a general-purpose scripting language designed for advanced text processing. It…

Read article
How to understand Squid proxy and how to configure Squid proxy.
March 5, 2023

How to understand Squid proxy and how to configure Squid proxy.

How To Understand Squid Proxy And How To Configure Squid Proxy. A proxy is a server located between two networks; in this case, the most common implementation of a Squid proxy is the division between user computers and devices and the internet, divided or separated by a proxy server in the middle.…

Read article
How to install Debian 11
March 3, 2023

How to install Debian 11

How To Install Debian 11 Connect to java/html5 console, (here you can find an article that will show you how) How to access java/html5 console : Mount ISO: Virtual media &gt; Connect Virtual Image &gt; Map CD/DVD Click on: Connect Virtual Media. Click on: Map CD/DVD. Now click on: Map Device. Next…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, cloud hosting, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Support 24/7 · Billing 09:00 – 00:00