How to install WordPress with nginx on Debian Wheezy

Install WordPressWordPress is the most popular Content Management System (CMS) on the planet. Over 20% of websites, is powered by WordPress. It is free and open source. WordPress is built with PHP as server-side language and MySql as database.

Prerequisites for WordPress Installation

To get started with installing WordPress you?ll need to make sure that your server is ready for it.
You?ll need a Debian based server with root privileges and make sure you?ve nginx, PHP and MySql installed. If you don?t have these things installed, learn how to install nginx, PHP & MySql.

Download WordPress:

To download WordPress write the following command on your terminal:

Unzip the downloaded file with the following command:

This will unzip the WordPress files and you?ll get all of these files in a directory called wordpress on your home directory.

Create WordPress Database and User

As WordPress will need a MySql database, you?ll need to create one.
Let?s login to MySql now by executing the following command:

Provide your password and you?re logged in!

Create a database for WordPress:

Replace ?yourdbname? with your desired database name.

Now let?s create a user for the above database:

Replace ?youruser? with your preferred username.

Set password for the above user:

Replace ?youruser? & ?password? with your username and password.

Now grant permission to the user for this database:

Refresh MySql:

We?re done with MySql, let?s exit:

Setup the WordPress Configuration:

Create a copy of the wp-config-sample.php file as wp-config.php. This file will contain all of your configurations:

Now open wp-config.php file:

Find the following lines of codes and replace with your own database information:


Now, save the file and exit.

Move the files

Let?s create a directory where all of your WordPress files will be located. Replace with your domain name:

Move the WordPress files to WordPress root directory:

Give ownership to nginx user, replace username with your server username:

Set up nginx server blocks:

Now, you?ll need to set up your nginx server blocks (virtual host). Create a new file for the for WordPress host, copying the format from the default configuration. Replace with your domain name:

Open up the newly created file:

Add the following codes on that file, replace with your domain:


Save the file and exit.

Create Symbolic link for server block:

Create symbolic link for server block with the following command:

Remove the default server block:

Restart nginx:

WordPress Installation:

Now, access your WordPress online installation page by visiting this page:

Provide the information that the page is asking & you?re done!

Have a happy blogging!