DTechs

WordPress Installation for Your Domain in 5 Minutes

I will summurize the steps to install wordpress for your domain:

Assuming the installation will be done in Ubuntu. Commands can be modified easly with the respective package manager of your distribution if you are not using Ubuntu.

  1.  Prelimimary Software Installation : These commands are installing the MySQL as database, nginx as web server , php and fastcgi manager and php extensions.
    • apt install nginx
    • apt install mysql-server
    • apt install php
    • apt install php-gd
    • apt install php-ssh2
    • apt install php-fpm
  2. Create the Web Data  & Users :  This is sample directory hierarchy. It can be modified with your own needs.
    • mkdir /www
    • mkdir /www/<your_domain_name>
    • mkdir /www/source
    • cd /www/source
    • wget https://wordpress.org/latest.tar.gz
    • tar xzvf latest.tar.gz
    • mv wordpress/* ../<your_domain_name>/ # Moving WordPress Files to domain folder
    • cd /www/<your_domain_name>
    • chown -R www-data:www-data *  # www-data user and group are the nginx user & group in Ubuntu. You need to modify it with your nginx user and group.
  3. Create Database & Database User in MySQL
    • mysql -u root -p # Connect to mysql server with root user.During installation it has been requested the password.
    • <mysql command line>  CREATE DATABASE <your_domain_database_name>;
    • <mysql command line> CREATE USER '<user_for_domain_database_connection'@'localhost' IDENTIFIED BY 'password';
    • <mysql command line> grant all privileges on <user_for_domain_database_connection>.* to 'your_domain_database_name'@'localhost' ;
    • <mysql command line> flush privileges ;
    • <mysql command line> exit
  4. Configure Nginx & PHP for your domain
    • cd /etc/nginx/
    • cd sites-available/
    • cp default <your_domain_name>
    • rm default
    • vi <your_domain_name>root /www/<your_domain_name>;
      • index index.php index.html index.htm index.nginx-debian.html;
        
        server_name <your_domain_name;
        
        location ~ \.php$ {
         include snippets/fastcgi-php.conf;
        
        # With php7.0-cgi alone:
         fastcgi_pass 127.0.0.1:9000;
         }
    • cd ../sites-enabled/
    • ln -s /etc/nginx/sites-available/timex .
    • cd /etc/php/7.0/fpm/pool.d/
    • vi www.conf  : Change the PHP FastCGI Manager's Listening Address
      • listen = 127.0.0.1:9000
    • systemctl restart php7.0-fpm.service
    • systemctl restart nginx
  5. Configure your WordPress Config Php File
    • cd /www/<your_domain_name>
    • cp wp-config-sample.php wp-config.php
    • vi wp-config.php
      • define('DB_NAME', '<your_domain_database_name');
        
        /** MySQL database username */
        define('DB_USER', '<user_for_domain_database_connection>');
        
        /** MySQL database password */
        define('DB_PASSWORD', 'password');
        
        /** MySQL hostname */
        define('DB_HOST', 'localhost');
  6. Restart all the services & Voila ! your domain is up.
    • systemctl restart php7.0-fpm.service
    • systemctl restart nginx

 

What is missing ? Of course, the SSL site is missing. It needs to configured. I will try to add the SSL side commands later.