Bolt adalah sistem manajemen konten gratis, sumber terbuka, ringan, dan sederhana berdasarkan PHP. Ini dirancang untuk kemudahan penggunaan dan membantu Anda membuat situs web konten yang kuat dan dinamis dengan mudah. Itu dibangun di atas kerangka mikro Silex dan merupakan alternatif yang bagus bagi mereka yang mencari sistem PHP modern. Itu dibuat menggunakan perpustakaan sumber terbuka modern dan paling cocok untuk membangun situs dalam HTML5 dengan markup modern.
Dalam tutorial ini, kami akan menunjukkan cara menginstal Bolt CMS dengan Nginx dan Let's Encrypt SSL di Ubuntu 20.04.
Prasyarat
- Server yang menjalankan Ubuntu 20.04.
- Nama domain valid yang ditunjukkan dengan IP server Anda.
- Sandi root dikonfigurasi untuk server.
Memulai
Sebelum memulai, selalu disarankan untuk memperbarui sistem Anda dengan paket versi terbaru. Anda dapat memperbaruinya dengan perintah berikut:
apt-get update -y
Setelah semua paket diperbarui, instal dependensi lain dengan menjalankan perintah berikut:
apt-get install software-properties-common gnupg2 unzip git -y
Setelah menginstal semua dependensi, Anda dapat melanjutkan ke langkah berikutnya.
Instal Server LEMP
Pertama, instal server Nginx dan MariaDB dengan menjalankan perintah berikut:
apt-get install nginx mariadb-server -y
Selanjutnya, Anda perlu menginstal PHP versi 7.2 di server Anda. Secara default, Ubuntu 20.04 dikirimkan dengan PHP versi 7.4. Jadi, Anda perlu menambahkan repositori PHP Ondrej di sistem Anda.
Anda dapat menambahkan repositori PHP dengan perintah berikut:
add-apt-repository ppa:ondrej/php
Setelah repositori ditambahkan, perbarui repositori dan instal PHP dan ekstensi lain yang diperlukan dengan perintah berikut:
apt-get update -y
apt-get install php7.2 php7.2-cli php7.2-fpm php7.2-common php7.2-mbstring php7.2-zip php7.2-pgsql php7.2-sqlite3 php7.2-curl php7.2-gd php7.2-mysql php7.2-intl php7.2-json php7.2-opcache php7.2-xml -y
Once all the packages are installed, you can proceed to the next step.
Buat Database untuk Bolt
Selanjutnya, Anda perlu membuat database dan pengguna untuk Bolt. Pertama, login ke MariaDB dengan perintah berikut:
mysql
Setelah login, buat database dan user dengan perintah berikut:
MariaDB [(none)]> CREATE DATABASE boltdb;
MariaDB [(none)]> CREATE USER 'bolt'@'localhost' IDENTIFIED BY 'password';
Selanjutnya, berikan semua hak istimewa ke database Bolt dengan perintah berikut:
MariaDB [(none)]> GRANT ALL ON boltdb.* TO 'bolt'@'localhost';
Selanjutnya, flush hak istimewa dan keluar dari shell MariaDB dengan perintah berikut:
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;
Setelah selesai, Anda dapat melanjutkan ke langkah berikutnya.
Unduh CMS Baut
Pertama, Anda perlu mengunduh Bolt CMS versi terbaru dari repositori Git. Anda dapat mengunduhnya ke direktori root Nginx dengan menjalankan perintah berikut:
cd /var/www/html
git clone https://github.com/bolt/bolt.git
Setelah Bolt diunduh, ubah direktori menjadi bolt dan salin contoh file konfigurasi:
cd bolt
cp app/config/config.yml.dist app/config/config.yml
Selanjutnya, edit file config.yml dan tentukan pengaturan database Anda:
nano app/config/config.yml
Hapus baris database sqlite default dan tambahkan baris berikut:
database: driver: mysql username: bolt password: password databasename: boltdb host: localhost prefix: prefix_
Simpan dan tutup file setelah Anda selesai.
Selanjutnya, Anda perlu menginstal Komposer di sistem Anda. Komposer adalah manajer ketergantungan untuk PHP. Anda dapat menginstalnya dengan perintah berikut:
wget -O composer-setup.php https://getcomposer.org/installer
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
Setelah Komposer diinstal, Anda akan mendapatkan output berikut:
All settings correct for using Composer Downloading... Composer (version 2.0.2) successfully installed to: /usr/local/bin/composer Use it: php /usr/local/bin/composer
Selanjutnya, instal dependensi PHP yang diperlukan untuk Bolt CMS dengan perintah berikut:
composer install
Setelah semua dependensi terinstal, ubah kepemilikan dan izin direktori tebal:
chown -R www-data:www-data /var/www/html/bolt
chmod -R 755 /var/www/html/bolt
Setelah selesai, Anda dapat melanjutkan ke langkah berikutnya.
Konfigurasi Nginx untuk Bolt
Selanjutnya, Anda perlu membuat file konfigurasi virtual host Nginx untuk Bolt CMS. Anda dapat membuatnya dengan perintah berikut:
nano /etc/nginx/sites-available/bolt.conf
Tambahkan baris berikut:
server { listen 80; root /var/www/html/bolt; index index.php index.html index.htm; server_name bolt.example.com; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ [^/]\.php(/|$) { try_files /index.php =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_index index.php; fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; include fastcgi_params; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } location = /bolt { try_files $uri /index.php?$query_string; } location ^~ /bolt/ { try_files $uri /index.php?$query_string; } }
Simpan dan tutup file setelah selesai kemudian aktifkan file virtual host Nginx menggunakan perintah berikut:
ln -s /etc/nginx/sites-available/bolt.conf /etc/nginx/sites-enabled/bolt.conf
Selanjutnya, verifikasi Nginx untuk kesalahan konfigurasi dengan perintah berikut:
nginx -t
Anda akan melihat output berikut:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
Terakhir, restart layanan Nginx untuk menerapkan perubahan:
systemctl restart nginx
Pada titik ini, Nginx dikonfigurasi untuk melayani Bolt CMS. Sekarang Anda dapat melanjutkan ke langkah berikutnya.
Akses Bolt CMS
Sekarang, buka browser web Anda dan ketik URL http://bolt.example.com . Anda akan diarahkan ke halaman berikut:
Berikan nama pengguna, sandi, email yang Anda inginkan dan klik Buat pengguna pertama tombol. Anda akan melihat dasbor Bolt CMS di halaman berikut:
Sekarang, klik Lihat situs tombol. Anda akan melihat halaman situs sederhana Bolt CMS di halaman berikut:
Amankan BoltCMS dengan Let's Encrypt SSL
Itu selalu merupakan ide yang baik untuk mengamankan situs web Anda dengan Let's Encrypt SSL. Pertama, instal klien Certbot Let's Encrypt di server Anda dengan perintah berikut:
apt-get install python3-certbot-nginx -y
Setelah terinstal, amankan situs web Anda dengan Let's Encrypt SSL dengan menjalankan perintah berikut:
certbot --nginx -d bolt.example.com
Anda akan diminta untuk memberikan alamat email yang valid dan menerima persyaratan layanan seperti yang ditunjukkan di bawah ini:
Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator nginx, Installer nginx Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): [email protected] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v02.api.letsencrypt.org/directory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (A)gree/(C)ancel: A - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y Obtaining a new certificate Performing the following challenges: http-01 challenge for bolt.example.com Waiting for verification... Cleaning up challenges Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/bolt.conf
Selanjutnya, pilih apakah akan mengarahkan lalu lintas HTTP ke HTTPS seperti yang ditunjukkan di bawah ini:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: No redirect - Make no further changes to the webserver configuration. 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this change by editing your web server's configuration. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Ketik 2 dan tekan Enter untuk menyelesaikan instalasi. Anda akan melihat output berikut:
Redirecting all traffic on port 80 to ssl in /etc/nginx/sites-enabled/bolt.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://bolt.example.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=bolt.example.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/bolt.example.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/bolt.example.com/privkey.pem Your cert will expire on 2020-10-30. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot renew" - Your account credentials have been saved in your Certbot configuration directory at /etc/letsencrypt. You should make a secure backup of this folder now. This configuration directory will also contain certificates and private keys obtained by Certbot so making regular backups of this folder is ideal. - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le - We were unable to subscribe you the EFF mailing list because your e-mail address appears to be invalid. You can try again later by visiting https://act.eff.org.
Sekarang, situs web BoltCMS Anda diamankan dengan Let's Encrypt SSL. Anda dapat mengaksesnya dengan aman menggunakan URL https://bolt.example.com
Kesimpulan
Selamat! Anda telah berhasil menginstal Bolt CMS dengan Nginx dan Let's Encrypt SSL di server Ubuntu 20.04. Anda sekarang dapat dengan mudah membuat situs web Anda sendiri menggunakan dasbor Bolt. Jangan ragu untuk bertanya kepada saya jika Anda memiliki pertanyaan.