Cara Install WordPress di Ubuntu 14.04

Step by step cara install WordPress di Ubuntu 14.04 dengan Nginx, MySQL, PHP (LEMP). Jika anda belum menginstall LEMP ikuti tutorialnya di : Cara Install LEMP – Nginx, MySQL, PHP di Ubuntu 14.04.

Buat Database

Sesuaikan dengan yang anda inginkan

mysql -u root -p
create database namaDatabaseAnda;
CREATE USER 'UserDatabaseAnda'@'localhost' IDENTIFIED BY 'PasswordUserAnda';
GRANT ALL ON NamaDatabaseAnda.* TO 'UserDatabaseAnda'@'localhost';
FLUSH PRIVILEGES;
exit

Download WordPress

Masuk ke direktori utama website

cd /var/www/html

Kemudian download WordPress

wget http://wordpress.org/latest.tar.gz
tar -xvf latest.tar.gz
cp -r wordpress/* /var/www/html
rm -rf wordpress

Kofigurasi Database MySQL WordPress

Buka file wp-config.php

nano /var/www/html/wp-config.php

Cocokkan dengan database yang anda buat

/** The name of the database for WordPress */
define('DB_NAME', 'namaDatabaseAnda');

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

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

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

Save dan Exit Ctrl+X kemudian jawab dengan y, Enter

Atur Permission

Atur perizinan berdasarkan kelompok pengguna (Group Ownership).

chown -R www-data:www-data /var/www/html/*

Nginx pada ubuntu beroperasi dibawah user www-data dan group user www-data, anda bisa mengubah untuk user tertentu misalnya: namauser:www-data.

Kemudian ubah CHMOD folder (755) dan file (644) secara masal

find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

Konfigurasi Nginx – WordPress

Backup konfigurasi Nginx server block,

mv /etc/nginx/sites-available/default /root/default_nginx.backup

Setelah dibackup ganti yang baru

nano /etc/nginx/sites-available/default

Copy-Paste dan sesuaikan dengan yang dibawah ini.

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        server_name idnetter.com;

        client_max_body_size 5m;
        client_body_timeout 60;

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log error;

        root /var/www/html/;
        index  index.html index.php;

        ### root directory ###
        location / {
                try_files $uri $uri/ /index.php?$args;
        }

        ### security ###
        error_page 403 =404;
        location ~ /\. { access_log off; log_not_found off; deny all; }
        location ~ ~$ { access_log off; log_not_found off; deny all; }
        location ~* wp-admin/includes { deny all; }
        location ~* wp-includes/theme-compat/ { deny all; }
        location ~* wp-includes/js/tinymce/langs/.*\.php { deny all; }
        location /wp-includes/ { internal; }
        location ~* wp-config.php { deny all; }
        location ~* ^/wp-content/uploads/.*.(html|htm|shtml|php)$ {
                types { }
                default_type text/plain;
        }

        ### disable logging ###
        location = /robots.txt { access_log off; log_not_found off; }
        location = /favicon.ico { access_log off; log_not_found off; }

        ### caches ###
        location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ { access_log off; expires max; }
        location ~* \.(woff|svg)$ { access_log off; log_not_found off; expires 30d; }
        location ~* \.(js)$ { access_log off; log_not_found off; expires 7d; }

        ### php block ###
        location ~ \.php?$ {
                try_files $uri =404;
                include fastcgi_params;
                fastcgi_pass unix:/var/run/php5-fpm.socket;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_intercept_errors on;
                fastcgi_split_path_info ^(.+\.php)(.*)$;
                #Prevent version info leakage
                fastcgi_hide_header X-Powered-By;
       }
}

Save dan Exit Ctrl+X kemudian jawab dengan y, Enter

Restart Nginx dan PHP-FPM

Selesai konfigurasi Nginx, restart service nginx dan php-fpm

service nginx restart
service php5-fpm restart

Install WordPress

Buka browser arahkan ke domain anda dan ikuti proses installasi WordPress seperti biasanya.

Alhamdulillah tutorial cara install dan konfigurasi WordPress di Ubuntu 14.04 dengan Nginx selesai. Selamat mencoba.

 




Share this post:

Leave a Reply

Your email address will not be published. Required fields are marked *