WordPress is, undoubtedly, the most broadly utilized publishing content to a blog stage in the world. In any case, the apparatus can be utilized for substantially more than simply writing for a blog. With the right expansion of augmentations, you can transform WordPress into a web based business website, an interactive media webpage, and considerably more.
On the off chance that you end up having your very own worker, you can have a WordPress establishment, without hosting to go to a third gathering. What’s more, that is actually the thing we will do here. In this instructional exercise, you will figure out how to introduce the important parts just as the WordPress stage on Ubuntu Server 18.04. This will just expect a certain something: That you have Ubuntu Server going.
Conditions
The main thing to do is to get our LAMP (Linux Apache MySQL PHP) worker going. Since Ubuntu is as of now there, all that should be done is introduce the auxiliary parts. Since we’re utilizing Ubuntu, this should be possible with a solitary order. In any case, before we do that, we need to ensure our worker is forward-thinking. Open a terminal window and issue the accompanying orders:
sudo apt-get update sud
Should the piece get redesigned all the while, a reboot will be fundamental. In case that is the situation, the worker should be restarted (so the progressions will produce results). This implies you should run the update/overhaul when a reboot is feasible.
With the update/redesign far removed, it’s an ideal opportunity to introduce the web/data set workers and PHP. This should be possible with a solitary order:
sudo apt install apache2 p
During the establishment, you will be incited to make/confirm a secret key for the MySQL administrator client. At the point when the interaction finishes, you can direct a program toward http://SERVER_IP (Where SERVER_IP is the IP address of your Ubuntu Server) to see the Apache invite screen.
Next we need to introduce a couple of vital PHP expansions. This should be possible with the order:
sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap
Empowering SSL
Before we get into the design of Apache and the establishment of WordPress, we will set up our worker to utilize SSL (Secure Sockets Layer), which are different web conventions that cooperate to wrap ordinary HTTP traffic in an ensured, encoded covering. So HTTP becomes HTTPS. As I am just setting up a testing worker, I’ll make a self-marked SSL testament for an IP address. To do this, follow these means.
Produce the SSL authentication with the accompanying order:
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apac
At the point when you run that order, you’ll be needed to respond to the accompanying inquiries:
Nation Name (2 letter code) [AU]:
State or Province Name (complete name) [Some-State]:
Region Name (eg, city) []:
Association Name (eg, company)[]
Authoritative Unit Name (eg, area) []:
Normal Name (for example worker FQDN or YOUR name) []:
Email Address []:
It is significant, for oneself marked declaration, that you enter the IP address of your worker for the Common Name section.
Next we design Apache to utilize SSL. Make another record with the order:
sudo nano /etc/apache2/conf-availabl
In that new file, paste the following:
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 SSLHonorCipherOrder On # Disable preloading HSTS for now. You can use the commented out header line that includes # the "preload" directive if you understand the implications. # Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" Header always set X-Frame-Options DENY Header always set X-Content-Type-Options nosniff # Requires Apache >= 2.4 SSLCompression off SSLUseStapling on SSLStaplingCache "shmcb:logs/stapling-cache(150000)" # Requires Apache >= 2.4.11 SSLSessionTickets Off
Sa
Now we’re going to create a new default-ssl.conf file. Before we do that, backup the original with the command:
sudo cp /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-available/def
Create the new file with the command:
sudo nano /etc/apache2/sites-available
In that new file, paste the following:
<IfModule mod_ssl.c> <VirtualHost _default_:443> ServerAdmin YOUR_EMAIL ServerName SERVER_IP DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLEngine on SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> </VirtualHost> </IfModule>
Where SERVER_IP is the IP address of your server and YOUR_EMAIL
Save and close that file.
Now we’re going to set up a redirect so that all HTTP traffic is automatically redirected to HTTPS. To do this, create a new file with the command:
sudo nano /etc/apache2/sites-available
In that file, add the following line under the DocumentRoot entry:
Redirect “/” “ht
Where SERVER_IP is the IP address of your server.
Save and close that file.
Next we need to enable a few modules and hosts with the commands:
sudo a2enmod ssl sudo a2enmod headers sudo a2ensite default-ssl sudo a2
Finally, restart Apache with the command:
sudo systemct
You should now be able to point your browser to https://SERVER_IP (Where SERVER_IP is the IP address of your server) and still see the Apache Welcome Screen.
The Database
Before you start setting up your database, you should use MariaDB/MySQL’s built-in function to secure your new installation. Run the command, and accept the defaults to secure your database. When asked, set up a secure password for database’s root user.
sudo mysql_secure_installation
Once that’s complete, you’re ready to start working with MariaDB using the “mysql” command
WordPress depends upon a database to function. To create that, you first must log into the MySQL prompt with the command:
sudo
You will be prompted for the MySQL admin user password you created during the LAMP server installation. At the MySQL prompt, create the database with the command:
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE
Next, create a new user and grant that user permission to access the database with the command:
GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY &#
Where PASSWORD is a unique, strong password.
Flush the database privileges and exit with the commands:
FLUSH PRIV
Allow .htaccess and Enable the Rewrite Module
We need to enable .htaccess for WordPress. To do this, create a new Apache configuration file with the command:
sudo nano /etc/apache2/sites-availab
In that file paste the following:
<Directory /var/www/html/wordpress/> AllowOverride All &
Enable the rewrite module with the command:
sud
Restart Apache with the command:
sudo systemct
Download, Unpack, and Prepare WordPress
We’re going to download the official WordPress file with the following commands:
cd /tmp curl -O https://wordpress.
Unpack WordPress with the command:
tar x
Create a dummy .htaccess file with the command:
touch /tmp/wo
Copy the sample configuration file to the necessary config file with the command:
cp /tmp/wordpress/wp-config-sample.php /tmp/wordpr
Create an upgrade directory (to avoid permissions issues) with the command:
mkdir /tmp/wordpress/w
Copy the contents of the wordpress directory into the document root with the command:
sudo cp -a /tmp/wordpress/. /var/w
Finally, adjust the ownership and permissions of the newly moved wordpress directory with the commands:
sudo chown -R www-data:www-data /var/www/wordpress sudo find /var/www/wordpress/ -type d -exec chmod 750 {} \; sudo find /var/www/wordpress/ -type f -exe
Configuring WordPress
This section gets a bit complicated. The wp-config.php file needs to be edited, but before that can be done, you must download unique secret keys to be added to the config file. To get those keys, visit the online generator from the WordPress developers.
This will output a number of long strings, each associated with a specific configuration option. Each string is associated with the following values in the configuration file:
AUTH_KEY
SECURE_AUTH_KEY
LOGGED_IN_KEY
NONCE_KEY
AUTH_SALT
SECURE_AUTH_SALT
LOGGED_IN_SALT
NONCE_SALT
Copy those values into another file. Next open the WordPress configuration file with the command:
sudo nano /var/www/wordpr
Locate the values above and paste the secret key for each. After that, scroll up and edit the values for:
DB_NAME
DB_USER
DB_PASSWORD
The above values were created earlier (with MySQL).
Save and close that file.
Complete the Installation
You can now point your browser to https://SERVER_IP/wordpress and walk through the web-based installer to complete the installation. After a couple of clicks and a bit of typing, your instance of WordPress will be up and running.