How to Install WordPress with Apache and Let’s Encrypt SSL on Debian 11

7

WordPress is the preferred content material control gadget on the net. It is unfastened, open-source, and works neatly with nearly any internet webhosting carrier, making it some of the highest to put in and use.

If you do not need internet webhosting but, we advise putting in WordPress in your native Debian gadget or VPS.

Here, we can see find out how to set up WordPress with Apache on Debian 11.

Prerequisites

Install LAMP Stack

Follow the beneath hyperlink to put in the LAMP stack in your Debian gadget

Install AMP (Apache, MariaDB, and PHP) on Debian 11

Install PHP Extensions for WordPress

Use the apt command to put in the PHP extensions required for a WordPress set up.

sudo apt set up -y php-curl php-xml php-common php-imagick php-json php-mbstring php-mysql php-zip php-bcmath php-gd php-int

Configure PHP for WordPress

The default PHP values will not be suitable for everybody and you’ll want to exchange them in response to the requirement. So, edit the php.ini record.

sudo nano /and so on/php/7.4/apache2/php.ini

Then, replace the beneath values as in step with your requirement. You might get started with the beneath values for now and building up or lower the values every time required.

max_execution_time = 300

upload_max_filesize = 64M

post_max_size = 64M

Setup Apache Virtual Host

We will get started with growing an Apache digital host for a WordPress set up. You can in finding all Apache digital host configuration information beneath /and so on/apache2/sites-available listing.

Typically digital host information comprise a site title, port quantity, file root, log location, rapid CGI, and so on.

Assume the next,

Domain title: www.holhol24.internet
Port No: 80
Document root: /var/www/html/www.holhol24.internet/

Create a digital host configuration.

sudo nano /and so on/apache2/sites-available/www.holhol24.internet.conf

Then, position the next content material into the above configuration record. You will want to exchange ServerName as in step with your requirement.



   ServerName holhol24.internet
   ServerAlias www.holhol24.internet
   ServerAdmin admin@holhol24.internet
   DocumentRoot /var/www/html/www.holhol24.internet


   ErrorLog ${APACHE_LOG_DIR}/www.holhol24.net_error.log
   CustomizedLog ${APACHE_LOG_DIR}/www.holhol24.net_access.log mixed


   
      Options FollowSymlinks
      AllowOverride All
      Require all granted
   

Next, create a file root listing to put WordPress information.

sudo mkdir -p /var/www/html/www.holhol24.internet/

Enable the digital host and SSL, rewrite modules.

sudo a2ensite www.holhol24.internet

sudo a2enmod rewrite ssl

Then, restart the Apache carrier.

sudo systemctl restart apache2

Install Let’s Encrypt SSL Certificate

Create DNS Record

Go for your area registrar and create an A and CNAME (non-compulsory if you don’t want to make use of www subdomain) document to your area. Typically you’ll have to make two information to your WordPress web page.

  1. Non-www Domain Name (Ex. holhol24.internet) >> A document level for your server IP
  2. www Domain Name (Ex. www.holhol24.internet) >> CNAME document level to holhol24.internet

For this demo, I can create two information in order that my WordPress web page can be obtainable at www.holhol24.internet.

DNS Records

Install Certbot consumer

The Certbot consumer, which is helping us generate and set up the Let’s Encrypt SSL certificates, is now out there as a snap bundle for Debian working gadget. So, first, set up snapd daemon in your gadget.

sudo apt replace

sudo apt set up -y snapd

Then, replace snapd to the newest model.

sudo snap set up core && sudo snap refresh core

Finally, set up the Certbot consumer the use of the beneath command.

sudo snap set up --classic certbot

sudo ln -s /snap/bin/certbot /usr/bin/certbot

Install SSL Certificate

Use the beneath command to generate and set up the Let’s Encrypt SSL certificates at the Apache webserver.

sudo certbot --apache

1. Enter e-mail deal with to obtain notification on pressing renewal and safety notices
2. Type Y and press Enter to sign up with the ACME server
3. Type Y or N to obtain emails about EFF information, campaigns, and newsletters.
4. Certbot will routinely stumble on the WordPress area and ask you permission to turn on HTTPS to your WordPress web page. Type 1 or suitable numbers separated through a comma you probably have more than one internet sites.

Which names do you want to turn on HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: holhol24.internet
2: www.holhol24.internet
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the right numbers separated through commas and/or areas, or go away enter
clean to choose all choices proven (Enter 'c' to cancel): 1,2

Wait for the SSL set up to finish.

Redirect non-www HTTP requests to www HTTPS with Apache

The Certbot consumer will position the desired regulations to redirect the site visitors from HTTP to the HTTPS web page.

1. http://holhol24.internet >> https://holhol24.internet

2. http://www.holhol24.internet >> https://www.holhol24.internet

As you’ll be able to see, the primary area isn’t achieving www HTTPS with regulations positioned through Certbot. So, you’ll have to upload a rule manually to redirect site visitors from non-www HTTP to www HTTPS area if required, I.e., http://holhol24.internet >> https://www.holhol24.internet.

Auto-Renew SSL Certificate

The Certbot consumer comes with a systemd carrier that looks after computerized certificates renewals. So, you’re going to no longer must renew the certificate manually.

Install WordPress with Apache on Debian 11

Create WordPress Database

First, login into MariaDB/MySQL database server.

sudo mysql -u root -p

Then, create the database for WordPress set up at the side of the database consumer and password.

CREATE DATABASE wpdatabase;

CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'wppassword';

GRANT ALL PRIVILEGES ON wpdatabase.* TO 'wpuser'@'localhost';

EXIT

Download WordPress

Download the newest model of the WordPress information through the use of the next command.

wget https://wordpress.org/newest.tar.gz

Then, extract the downloaded record.

tar -zxvf newest.tar.gz

And then, transfer the information for your web page file root listing.

sudo mv wordpress/* /var/www/html/www.holhol24.internet/

Update the possession and a bunch of the WordPress listing.

sudo chown -R www-data:www-data /var/www/html/www.holhol24.internet/

Install WordPress

Open your browser and talk over with your WordPress web page area to accomplish the WordPress set up.

https://your-wordpress-website

1. Choose the Installation Language and click on Continue

2. Click Let’s pass!

3. Enter the WordPress database main points after which click on Submit

4. Click Run the set up

5. Enter the WordPress web page knowledge after which click on Install WordPress

6. Click Log In to get entry to the WordPress admin backend to control WordPress set up. Alternatively, you’ll be able to get entry to the WordPress backend through going to https://your-wordpress-website/wp-admin

Access WordPress Website

Now, it is possible for you to to get entry to the web site together with your area title.

https://your-wordpress-website

WordPress with Apache
WordPress with Apache

Conclusion

That’s All. I am hoping you will have realized find out how to set up WordPress with Apache on Debian 11.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More