
Content.id – Cara Install WordPress dengan Menggunakan Caddy Webserver di Centos 7. WordPress adalah salah satu cms (Content Management System) yang sangat populer dan banyak digunakan oleh banyak webmaster untuk membuat blog, atau pun website besar secara mudah dan instant. Semua administrasi wordpress dilakukan melalui web interface.
Biasanya wordpress di install menggunakan LAMP (Linux Apache MySQL PHP) atau LEMP (Linux EnginX MySQL PHP) atau bisa juga kombinasi Linux EnginX Apache (Backend) MySQL dan PHP. Dengan Nginx atau Apache sebagai webserver.
Prerequisites:
- Sediakan VPS CentOS 7 bisa menggunakan VPS dari Digital Ocean atau dari Provider Manapun. Jika belum memiliki vps baca Cara Mendapatkan Balance $100 Digital Ocean dan Cara Membuat Droplet (VPS) di Digital Ocean
- VPS CentOS 7 sudah terinstall Caddy Webserver. Jika Caddy Webserver belum diinstall silahkan baca: Cara Menginstall Caddy Webserver di Centos 7
- VPS CentOS 7 sudah terinstall MySQL atau MariaDB. Jika belum terinstall silahkan baca Cara Menginstall MariaDB di Centos 7
Step 1 — Installing PHP
1. Jalankan perintah berikut untuk melakukan instalasi PHP di Centos 7
yum install php php-fpm php-mysql php-curl php-gd php-mbstring php-mcrypt php-xml php-xmlrpc
[[email protected] ~]# yum install php php-fpm php-mysql php-curl php-gd php-mbstring php-mcrypt php-xml php-xmlrpc Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.sfo12.us.leaseweb.net * extras: mirror.sfo12.us.leaseweb.net * updates: mirror.sfo12.us.leaseweb.net No package php-mcrypt available. Resolving Dependencies --> Running transaction check ---> Package php.x86_64 0:5.4.16-45.el7 will be installed --> Processing Dependency: php-cli(x86-64) = 5.4.16-45.el7 for package: php-5.4.16-45.el7.x86_64 --> Processing Dependency: httpd-mmn = 20120211x8664 for package: php-5.4.16-45.el7.x86_64 --> Processing Dependency: httpd for package: php-5.4.16-45.el7.x86_64 ---> Package php-common.x86_64 0:5.4.16-45.el7 will be installed
2. Setelah instalasi cek apakah PHP sudah terinstall di Centos 7 dan mengecek Versi PHP yang terinstall di Centos 7
php -v
[[email protected] ~]# php -v PHP 5.4.16 (cli) (built: Apr 12 2018 19:02:01) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies [[email protected] ~]#
3. Buka file configurasi PHP di /etc/php-fpm.d/www.conf cari user dan group apache
vi /etc/php-fpm.d/www.conf
; Unix user/group of processes ; Note: The user is mandatory. If the group is not set, the default user's group ; will be used. ; RPM: apache Choosed to be able to access some dir as httpd user = apache ; RPM: Keep a group allowed to write in log dir. group = apache
Ganti dengan caddy
; Unix user/group of processes ; Note: The user is mandatory. If the group is not set, the default user's group ; will be used. ; RPM: apache Choosed to be able to access some dir as httpd user = caddy ; RPM: Keep a group allowed to write in log dir. group = caddy
4. Start php dengan perintah:
systemctl start php-fpm
Semua yang dibutuhkan oleh server untuk menjalankan wordpress di VPS CentOS 7 sudah terinstall sekarang saatnya kita membuat database untuk wordpress.
Step 2 — Creating a MySQL Database and Dedicated User
1. Login ke mysql dengan user dan password yang sudah di buat
mysql -u root -p
2. Buat database untuk wordpress di MySQL
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
3. Buat user dan grant wordpress akses
GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
4. Fluss previlage MySQL agar bisa di akses oleh username yang sudah dibuat untuk wordpress.
FLUSH PRIVILEGES;
5. Keluar dari MySQL
EXIT;
Step 3 — Downloading WordPress
Setelah semua hal yang dibutuhkan VPS CentOS 7 agar bisa menjalankan WordPress diinstall sekarang kita menuju instalasi wordpress itu sendiri.
1. Pindah ke direktori /var/www
cd /var/www
2. Download file WordPress dari situs http://wordpress.org
curl -O https://wordpress.org/latest.tar.gz
3. Extract file tarbal wordpress
tar zxf latest.tar.gz
4. Hapus file tarbal yang sudah di extract
rm latest.tar.gz
5. Ubah kepemilikan folde wordpress agar bisa di akses oleh Caddy
chown -R caddy:caddy wordpress
Step 4 — Configuring Caddy to Serve the WordPress Website
Langkah selanjutnya ada configurasi caddy agar domain bisa di akses oleh pengunjung.
1. Buka file configurasi caddy di /etc/caddy/Caddyfile
vi /etc/caddy/Caddyfile
2. Tambahkan pada file configurasi caddy
content.id { tls [email protected] root /var/www/wordpress gzip fastcgi / 127.0.0.1:9000 php rewrite { if {path} not_match ^\/wp-admin to {path} {path}/ /index.php?_url={uri} } }
- Ganti nama domain content.id ke nama domain yang di inginkan
- Ganti email pada baris tls dengan email sobat content.id
- Ganti Paht root sesuai dengan direktori instalasi wordpress
3. Simpan file configurasi Caddy
4. Restart Caddy
5. Akses website yang sudah di konfigurasi dan mulai install wordpress.