Install WordPress with Nginx on openSUSE

Install WordPress with Nginx on openSUSE

As you already know WordPress is a free and open-source content management system (CMS) based on PHP and MySQL which you can use to create a beautiful website, blog, or app.

In this article we will install WordPress with Nginx on an openSUSE VPS. So follow the easy steps below and you will have a fully functional WordPress site on your openSUSE Linux VPS.

1. REQUIREMENTS

We will be using our SSD 1 Linux VPS hosting plan for this tutorial. Before you start the installation, please make sure that you have Nginx, PHP-FPM and MySQL installed on your server. If not, follow our excellent tutorial about installing LEMP (Linux, Nginx, MariaDB & PHP) on openSUSE.

2. LOG IN TO YOUR SERVER VIA SSH

# ssh root@server_ip

You can check whether you have the proper OS installed on your server with the following command:

cat /etc/issue

You should get this output:

Welcome to openSUSE 13.1 "Bottle" - Kernel \r (\l).

The output you get may be different from this depending on the version of openSUSE you have.

3. UPDATE THE SYSTEM

Make sure your server is fully up to date using:

# zypper up

Also install wget and unzip because those commands will be needed later:

# zypper install wget unzip

4. INSTALL WORDPRESS

The document root that we will set for your WordPress website is /var/www/html/your_domain . Therefore, create and enter the directory:

# mkdir -p /var/www/html/your_domain

# cd /var/www/html/your_domain

Download the latest WP version:

# wget https://wordpress.org/latest.zip

Unzip the downloaded archive:

# unzip latest.zip

The files will be extracted into a directory called wordpress, so you’ll need to move the files/directories from inside to your current location (/var/www/html/your_domain). Use the below command:

# mv wordpress/* .

Delete the unnecessary directory and installation:

# rmdir wordpress/ && rm latest.zip

Assign the proper files/directories ownership so your Nginx web server can actually read the data:

# chown nginx: -R /var/www/html/rosehostingtest.com/

Your next step is to create a Nginx virtual host config file for the domain that you’ll use to host WordPress. Create a custom directory called conf.d where the Nginx conf file for your domain will reside.

# mkdir /etc/nginx/conf.d

Now open a file with your favorite text editor. We are naming the file ‘your_domain.conf’ however feel free to replace it with your actual domain. Don’t forget to add .conf at the end of the filename.

# nano /etc/nginx/conf.d/your_domain.conf

Paste the following:

server {
    server_name your_domain;

    access_log /var/log/nginx/your_domain-access.log;
    error_log /var/log/nginx/your_domain-error.log;
    root /var/www/html/your_domain;

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

    location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

Replace your_domain with your actual domain, save and close the file.

Test if your config is correct:

# nginx -t

If everything is OK, restart Nginx for the changes to take effect:

# service nginx restart

Last but not least, create the much needed MySQL database. Log into MySQL as root and execute the below queries:

# mysql -u root -p

mysql> create database wp;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on wp.* to wpuser@localhost identified by 'your_password';
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit

With that taken care of the only thing you need to do is to update the wp-config.php file with the newly created database credentials. But first, copy the sample file into a new wp-config.php file.

# cp wp-config-sample.php  wp-config.php

Open the file:

# nano wp-config.php

After updating the database credentials, the lines should look like this:

 // ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wp');

/** MySQL database username */
define('DB_USER', 'wpuser');

/** MySQL database password */
define('DB_PASSWORD', 'your_password');

/** MySQL hostname */
define('DB_HOST', 'localhost');

Save and close the file.

Now open your favorite web browser and navigate to http://your_domain.com to finish the WordPress installation.

Congratulations, you have successfully installed WordPress with Nginx on OpenSuse on our Optimized WordPress Hosting. You may want to check our article on how to secure WordPress on a Linux VPS and implement the tips written there.


Of course you don’t have to do any of this if you use one of our OpenSuse VPS Hosting services, in which case you can simply ask our expert Linux admins to install WordPress for you.They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Comment