Menggunakan WordPress di Freebsd - Instalasi dan Konfigurasi untuk Blog

· 2 min read

WordPress merupakan sistem manajemen konten (CMS) dan platform blog populer yang memungkinkan Anda membuat situs web dengan cepat. Berkat dukungan plu

Blog merupakan salah satu jenis situs web yang diperbarui secara berkala dan memberikan wawasan mengenai suatu topik tertentu. Kata blog merupakan gabungan dari kata "web" dan "log". Awalnya, blog hanya berupa buku harian daring, tempat orang-orang dapat mencatat kejadian sehari-hari. Lambat laun, blog berkembang menjadi situs web penting bagi individu maupun perusahaan untuk berbagi informasi dan pengetahuan. Tak hanya itu, banyak di antara kita yang juga dapat menghasilkan uang dari blog.

Pada artikel ini, kami akan mencoba membahas cara membuat blog di server FreeBSD. Untuk memudahkan pembaca mempelajari cara membuat blog di FreeBSD, pembahasan blog ini akan dibagi menjadi beberapa sesi. Setiap sesi akan memandu Anda mulai dari tahap persiapan hingga blog dapat dipublikasikan. Pada sesi pertama ini, kami akan mencoba membahas cara membuat WordPress di server FreeBSD.

WordPress merupakan sistem manajemen konten (CMS) dan platform blog populer yang memungkinkan Anda membuat situs web dengan cepat. Berkat dukungan plugin dan template, CMS ini sangat dapat disesuaikan dan memungkinkan Anda untuk men-debug fungsionalitas situs sesuai dengan kebutuhan pengembang. WordPress mendukung berbagai macam situs, dari blog sederhana hingga situs e-dagang yang lengkap.

Spesifikasi sitem yang digunakan

OS: FreeBSD 13.2 Stable
CPU: Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz
IP Address: 192.168.5.2
Hostname dan Domain: ns1.unixexplore.com
Web Server: Apache24
PHP: php82: 8.2.7
WordPress: 6.2.2,1
MySQL: mysql80-server
WordPress Database Name: wordpress
User name WordPress Database: bromo
WordPress Database Passwords: mahameru


1. Instal Apache dan PHP

Apache dan PHP akan digunakan sebagai server web, sehingga WordPress dapat berjalan di peramban web. Instalasi aplikasi ini merupakan instalasi awal sebelum membangun WordPress. Berikut ini adalah skrip untuk menginstal Apache dan PHP.

root@ns1:~ # pkg install apache24
root@ns1:~ # pkg install php82 mod_php82 php82-mysqli
root@ns1:~ # pkg install php82-gd php82-phar php82-ctype php82-filter php82-iconv php82-curl php82-mysqli php82-pdo php82-tokenizer php82-mbstring php82-session php82-simplexml php82-xml php82-zlib php82-zip php82-dom php82-pdo_mysql php82-ctype
Agar mod PHP dapat berjalan di Apache, edit file /usr/local/etc/apache24/httpd.conf. Letakkan skrip di bawah ini di bagian paling akhir file httpd.conf.

<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

LoadModule php_module         libexec/apache24/libphp.so

<FilesMatch "\.php$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz

AddType application/x-httpd-php .php
AddType application/x-httpd-php .php .phtml .php3
AddType application/x-httpd-php-source .phps


Buat file php.ini dengan menyalin file php.ini-production ke php.ini. File tersebut terletak di direktori /usr/local/etc.

root@ns1:~ # cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
Buat sertifikat SSL.

root@ns1:~ # cd /etc/ssl
root@ns1:/etc/ssl # wget http://curl.haxx.se/ca/cacert.pem
Langkah selanjutnya adalah mengedit file /usr/local/etc/php.ini dan mengaktifkan skrip di bawah ini dalam file php.ini.

extension=mysqli.soopenssl.cafile=/etc/ssl/cacert.pemcgi.fix_pathinfo=0

Kemudian tambahkan skrip ini di bagian atas skrip di file php.ini, letakkan tepat setelah kata [PHP] atau di bagian bawah kata [PHP].

listen.owner = www
listen.group = www
listen.mode = 0660

Untuk menguji modul PHP, Anda memerlukan file info.php. Buat file baru dengan nama info.php dan tempatkan di folder /usr/local/www/apache24/data. Di file info.php, masukkan skrip seperti di bawah ini.

root@ns1:~ # touch /usr/local/www/apache24/data/info.php
root@ns1:~ # ee /usr/local/www/apache24/data/info.php
<?php phpinfo(); ?>
Langkah selanjutnya adalah membuat nama server dan Alamat IP Server di berkas httpd.conf. Buka berkas /usr/local/etc/apache24/httpd.conf dan cari skrip "Listen" dan "ServerName" lalu ganti dengan skrip di bawah ini.

Listen 192.168.5.2:80
ServerName www.unixexplore.com:80

Nonaktifkan saja skrip bawaan "Listen 80", dengan menambahkan tanda "#" di awal skrip #Listen 80. Setelah semua konfigurasi di atas dilakukan, aktifkan aplikasi server web Apache dengan mengetikkan skrip berikut di berkas /etc/rc.conf.

root@ns1:~ # ee /etc/rc.conf
apache24_enable="YES"
So that the Apache application runs immediately, restart the Apache application.

root@ns1:~ # service apache24 restart


2. Test Apache dan PHP

Saatnya kita melakukan pengujian aplikasi Apache dan PHP. Pertama, kita uji aplikasi Apache. Buka browser Yandex, Chrome, Firefox atau sesuai selera. Pada web browser, ketik IP server FreeBSD, yaitu http://192.168.5.2. Bila muncul tulisan "It works!" berarti web server Apache24 berjalan normal.

Lanjutkan dengan pengujian modul PHP, masih pada web browser ketik IP Address server FreeBSD, yaitu http://192.168.5.2/info.php.


3. Instal Database MySQL Server

Aplikasi lain yang dibutuhkan WordPress adalah MySQL Server. Aplikasi ini digunakan untuk masuk ke Dashboard dan menyimpan basis data WordPress. Masukkan skrip berikut untuk menginstal MySQL Server.

root@ns1:~ # pkg install mysql80-client
root@ns1:~ # pkg install mysql80-server
Tunggu hingga proses instalasi selesai, setelah itu hapus file di direktori /var/db/mysql.

root@ns1:~ # rm -rf /var/db/mysql/
Berikan nama pengguna dan grup "mysql" di folder /usr/local/etc/mysql.

root@ns1:~ # chown -R mysql:mysql /usr/local/etc/mysql
Aktifkan Server MySQL saat Start Up rc.d, dengan mengetik mysql_enable="YES" di file /etc/rc.conf.

root@router2:~ # ee /etc/rc.conf
mysql_enable="YES"
Berikutnya, jalankan aplikasi Mysql Server.

root@ns1:~ # service mysql-server restart
Setelah komputer kembali normal, buat kata sandi root Server MySQL.

root@ns1:~ # mysql_secure_installation
Catat dan jangan lupa password MySQL Server yang telah Anda buat, nantinya password ini akan digunakan untuk masuk ke MySQL Server. Sekarang kita uji coba password yang telah dibuat sebelumnya, jika password tidak salah, lanjutkan dengan membuat database "Wordpress".

root@ns1:~ # mysql -u root -p
Enter password: masukkan password mysql yang anda buat diatas
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.32 Source distribution

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

root@localhost [(none)]> exit script exit untuk keluar dari mysql server
Bye
root@ns1:~ #

4. Instal dan konfigurasi WordPress

Cara tercepat dan termudah untuk menginstal WordPress pada Sistem FreeBSD adalah dengan menginstal paket pkg dari repositori FreeBSD. Skrip di bawah ini adalah untuk menginstal WordPress.

root@ns1:~ # pkg install wordpress
Sebelum kita dapat menjalankan WordPress melalui server web, WordPress perlu dikonfigurasikan agar dapat terhubung ke database yang telah dibuat sebelumnya. Buka folder tempat WordPress disimpan, yaitu /usr/local/www/wordpress, lalu salin file wp-config-sample.php ke wp-config.php.

root@ns1:~ # cd /usr/local/www/wordpress
root@ns1:/usr/local/www/wordpress # cp wp-config-sample.php wp-config.php
Script di atas akan membuat file baru bernama wp-config.php, edit file tersebut. Yang perlu diperhatikan saat mengedit file ini adalah script DB_NAME DB_USER DB_PASSWORD. Untuk mengisi script tersebut, diambil dari database MySql Server. Sekarang kita buka dan edit file "/usr/local/www/wordpress/wp-config.php".

<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the installation.
* You don't have to use the web site, you can copy this file to "wp-config.php"
* and fill in the values.
*
* This file contains the following configurations:
*
* * Database settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* @link https://wordpress.org/documentation/article/editing-wp-config-php/
*
* @package WordPress
*/

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

/** Database username */
define( 'DB_USER', 'bromo' );

/** Database password */
define( 'DB_PASSWORD', 'mahameru' );

/** Database hostname */
/**define( 'DB_HOST', 'localhost' );*/
define( 'ns1', 'localhost' );

/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The database collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

/**#@+
* Authentication unique keys and salts.
*
* Change these to different unique phrases! You can generate these using
* the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
*
* You can change these at any point in time to invalidate all existing cookies.
* This will force all users to have to log in again.
*
* @since 2.6.0
*/
define( 'AUTH_KEY', 'put your unique phrase here' );
define( 'SECURE_AUTH_KEY', 'put your unique phrase here' );
define( 'LOGGED_IN_KEY', 'put your unique phrase here' );
define( 'NONCE_KEY', 'put your unique phrase here' );
define( 'AUTH_SALT', 'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT', 'put your unique phrase here' );
define( 'NONCE_SALT', 'put your unique phrase here' );

/**#@-*/

/**
* WordPress database table prefix.
*
* You can have multiple installations in one database if you give each
* a unique prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';

/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the documentation.
*
* @link https://wordpress.org/documentation/article/debugging-in-wordpress/
*/
define( 'WP_DEBUG', false );

/* Add any custom values between this line and the "stop editing" line. */



/* That's all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}

/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';



root@ns1:~ # mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.32 Source distribution

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

root@localhost [(none)]> create database wordpress;
root@localhost [(none)]> CREATE USER bromo@localhost IDENTIFIED BY 'mahameru';
root@localhost [(none)]> GRANT ALL PRIVILEGES ON wordpress.* TO bromo@localhost;
root@localhost [(none)]> FLUSH PRIVILEGES;
oot@localhost [(none)]> exit
Bye
root@ns1:~ #
Karena secara default DocumentRoot Apache24 berada di folder /usr/local/www/apache24/data, pindahkan folder /usr/local/www/wordpress ke folder /usr/local/www/apache24/data.

root@ns1:~ # cd /usr/local/www
root@ns1:/usr/local/www # cp -rf wordpress/* /usr/local/www/apache24/data/
Setelah semuanya dikonfigurasi dengan benar dan tidak ada yang terlewat, sekarang saatnya membuka blog WordPress. Jika tidak ada kesalahan atau kelalaian dalam konfigurasi, WordPress seharusnya dapat dibuka. Di Yandex atau Chrome Web Browser, ketik http://192.168.5.2/index.php.


Menggunakan WordPress di Freebsd - Instalasi dan Konfigurasi untuk Blog




Menggunakan WordPress di Freebsd - Instalasi dan Konfigurasi untuk Blog



Menggunakan WordPress di Freebsd - Instalasi dan Konfigurasi untuk Blog



Jika sudah seperti gambar di atas, maka WordPress anda sudah berhasil dibuka. Silakan klik tombol "Lanjutkan", kemudian akan muncul menu untuk memasukkan username dan password, isikan username dan password database WordPress yang sesuai yaitu user bromo password semeru.

Saat mengetik http://192.168.5.2/index.php di Web Browser terjadi error PHP, lakukan install ulang aplikasi PHP seperti pada pembahasan 2. Biasanya pada browser Modzilla Firefx saat anda mengetik http://192.168.5.2/index.php dan enter, Firefox akan melakukan pengalihan ke https. Disarankan menggunakan browser Yandex atau Google Chrome.
Subscribe on LinkedIn Menggunakan WordPress di Freebsd - Instalasi dan Konfigurasi untuk Blog

Enclosures Link: Menggunakan WordPress di Freebsd - Instalasi dan Konfigurasi untuk Blog

Silahkan Berkomentar, Kakak...! Bunda...!

Posting Komentar