[42 seoul] Set up WordPress website with lighttpd, MariaDB, PHP

숭글·2022년 7월 22일
0

기타

목록 보기
11/14

Requirment

  • Set up a functional WordPress website with the following services: lighttpd, MariaDB, and PHP.

lighttpd - Web Server
PHP - Programming Language
mariaDB - Database Management System

to set up WordPress, it's required to set up Web server and DBMS which is able to read PHP first.

Install

-install lighthpd

su -
apt-get install lighttpd

start Lighttpd service and enable it to start after system reboot.

systemctl start lighttpd
systemctl enable lighttpd

-install PHP
download PHP and related modules.

apt-get install php php-fpm php-mysql

install Maria DB

apt install mariadb-server mariadb-client

to start and enable mariaDB.

systemctl start mysql.service
systemctl enable mysql.service

to secure mariadb.

mysql_secure_installation

and press 'y' for all the questions except to change the password.

restart mariadb server.

systemctl restart mysql.service

create DB server

create new db and user
and grant the user access to the db.

mysql -u root -p

CREATE DATABASE wpdb;

CREATE USER 'wpdbuser'@'localhost' IDENTIFIED BY 'new password';

GRANT ALL ON wpdb.* TO 'wpdbuser'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

FLUSH PRIVILEGES;
EXIT;

configure PHP setting

vi /etc/php/'put your PHP version'/fpm/php.ini

edit this line. (remove the annotation.)
and add some configuration you need. (optional)

cgi.fix_pathinfo=1

configure lighttpd setting

vi /etc/lighttpd/conf-available/15-fastcgi-php.conf

modify following below.

restart lighttpd.

sudo lighttpd-enable-mod fastcgi 
sudo lighttpd-enable-mod fastcgi-php
service lighttpd force-reload 

allow to access to ufw firewall the Webserver post 80.

ufw allow 80

install wordpress

wget -c https://wordpress.org/latest.tar.gz

tar -xvzf latest.tar.gz
mv wordpress/ /var/www/html/
chmod 755 -R /var/www/html/wordpress/

download and unzip wordpress.
and move wordpress folder into Webserver lighttpd folder.

port forwarding

create connection host IP port 8080 to VM IP port 80.

Run Webserver

open the browser and enter hostID:8080/wordpress.

then you can see below.

after setting a language,
you need to connect DB.

enter DB, user information you typed above. (also you need to log in.)

Finish!

profile
Hi!😁 I'm Soongle. Welcome to my Velog!!!

0개의 댓글