Support Online
Skip to main content

Installing WordPress with Nginx: High Performance Publishing on FreeBSD 10.1 Server

What Will You Learn in This Guide?

In this guide, you will learn how to install WordPress using Nginx on FreeBSD 10.1. You will create a high-performance WordPress site with the FEMP (FreeBSD, Nginx, MySQL, PHP) stack and configure PHP plugins and MySQL.

1. Install Required PHP Plugins for WordPress

Some PHP modules are required for WordPress to work properly. These are necessary for functions such as visual processing, secure connectivity, and data transfer.

Commands:

sudo pkg install php56-xml php56-hash php56-gd php56-curl php56-tokenizer php56-zlib php56-zip
  1. These commands install the 7 required PHP plugins for WordPress. After the installation is complete, restart the PHP-FPM service so it can recognize these modules:

rehash
sudo service php-fpm restart
  • This ensures PHP works properly with new extensions.

2. Prepare MySQL Database

  1. WordPress needs a MySQL database to store all its content. Create your database and grant access with the following commands.

Database and User Creation:


mysql -u root -p

  • After entering the password, create the database and authorize the user using these commands:

CREATE DATABASE wordpress;
CREATE USER wordpressuser@localhost IDENTIFIED BY 'sifre_girin';
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost;
FLUSH PRIVILEGES;
exit

3. Download and Configure WordPress Files

  1. Download the latest WordPress version from the official source and create the configuration file.

Commands:


cd ~
fetch http://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
cd wordpress
cp wp-config-sample.php wp-config.php

  • Edit the wp-config.php file as follows:

vi wp-config.php

  • And enter your database information like this:

define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpressuser');
define('DB_PASSWORD', 'sifre_girin');

  • Next, move the files to the correct directory and set appropriate permissions:

sudo rsync -avP ~/wordpress /usr/local/www
sudo chown -R www:www /usr/local/www/wordpress

4. Configure Nginx Server

  1. In order for WordPress to work properly, you need to edit the Nginx configuration.

Nginx Configuration:


sudo vi /usr/local/etc/nginx/nginx.conf

Two changes you need to make:

  1. Point the document root to the WordPress directory:

root /usr/local/www/wordpress;

  1. Add rewrite rules:

location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
  1. Save the changes and restart Nginx:

sudo nginx -t
sudo service nginx restart

5. Complete the Setup from the Browser

  • Now you have come to the last step of WordPress installation. Enter your server's IP address or domain in your web browser:

http://sunucu_ip

After selecting the installation language, you will be directed to the installation screen of WordPress. Specify the site title, administrator username and password and complete the installation.


Frequently Asked Questions (FAQ)

1. I'm getting the "Database Connection Failed" error, what should I do? Make sure you have entered the database name, username and password in the wp-config.php file correctly.

2. I get a 403 error after Nginx settings, what is the solution? Check the directory permissions and make sure that the owner of the /usr/local/www/wordpress directory is www:www.

3. Why does WordPress request FTP information when uploading updates? This is usually caused by a file ownership issue. Make sure you run the chown command on the correct directory.


Result

You now have a high-performance site running WordPress, installed with Nginx on FreeBSD 10.1. This guide allows you to set up a secure system by configuring PHP, MySQL and Nginx correctly. On the GenixNode platform, you can start your projects immediately with high-performance Nginx and WordPress installation. Our support team is ready to help you with installation and configuration!