Changes between Version 9 and Version 10 of Csle2022/Agenda/databaseandweb


Ignore:
Timestamp:
Nov 18, 2022, 1:02:53 PM (2 years ago)
Author:
admin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Csle2022/Agenda/databaseandweb

    v9 v10  
    131131    <Directory /var/www/web.dhammikalalantha.com/public_html>
    132132        Options -Indexes +FollowSymLinks
    133         AllowOverride All
    134133    </Directory>
    135134
     
    154153    <Directory /var/www/wp.dhammikalalantha.com/public_html>
    155154        Options -Indexes +FollowSymLinks
    156         AllowOverride All
    157155    </Directory>
    158156
     
    177175    <Directory /var/www/lms.dhammikalalantha.com/public_html>
    178176        Options -Indexes +FollowSymLinks
    179         AllowOverride All
    180177    </Directory>
    181178
     
    247244== Installing Wordpress CMS ==
    248245
     246WordPress is a free and open-source content management system (CMS) written in PHP language. Features include a plugin architecture and a template system, referred to within WordPress as "Themes". WordPress was originally created as a blog-publishing system but has evolved to support other web content types including more traditional mailing lists and Internet fora, media galleries, membership sites, learning management systems (LMS) and online stores.
     247
     248If you are hoping to start a blog or any other site WordPress would a most convenient and suitable choice. Then let's see how we can install WordPress in your own server.
     249
     250WordPress is written using PHP and it uses MySQL/MariaDB for storing its data we can install it in a LAMP stack environment. So as the first step we are going to create a database in MySQL/MariaDB as below.
     251
     252First login the MySQL server,
     253
     254{{{
     255mysql -u root -p
     256}}}
     257
     258Then create the database.
     259
     260{{{
    249261CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
    250 
     262}}}
     263
     264Then create a user for the database.
     265
     266{{{
    251267CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'dala1234';
    252 
     268}}}
     269
     270Next you need to grant permissions to user to do any operations on the database as below.
     271
     272{{{
    253273GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost';
    254 
     274}}}
     275
     276Then you have to set the authentication plugin to mysql_native_password plugin which will enable to login using the above created username and password.
     277
     278{{{
    255279UPDATE mysql.user set plugin = 'mysql_native_password' where User = 'wordpressuser';
    256 
     280}}}
     281
     282Lastly, flush privileges for these changes to take effect immediately. Then exit the mysql server.
     283
     284{{{
    257285FLUSH PRIVILEGES;
    258 
    259286EXIT;
     287}}}
     288
     289=== Install additional PHP extensions ===
     290
     291WordPress needs additional PHP extensions for its plugins to work. First, let’s update and install the necessary extensions using the following commands. Next for the extensions to start working, restart the Apache server.
     292
     293{{{
     294sudo apt update
     295sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
     296sudo systemctl restart apache2
     297}}}
     298
     299=== Allow Apache’s .htaccess to Handle Override and Rewrite Rules on the WordPress Site ===
     300
     301In Apache, .htaccess files provide a way to make configuration changes on a per-directory basis. To Enable this you have to go the virtual host configuration file of the WordPress site and add the AllowOverride directive within the Directory block pointing to the website’s document root.
     302
     303{{{
     304<VirtualHost *:80>
     305    ServerName wp.dhammikalalantha.com
     306    ServerAlias wp.dhammikalalantha.com
     307    ServerAdmin webmaster@wp.dhammikalalantha.com
     308    DocumentRoot /var/www/wp.dhammikalalantha.com/public_html
     309
     310    <Directory /var/www/wp.dhammikalalantha.com/public_html>
     311        Options -Indexes +FollowSymLinks
     312        AllowOverride All
     313    </Directory>
     314
     315    ErrorLog ${APACHE_LOG_DIR}/wp.dhammikalalantha.com-error.log
     316    CustomLog ${APACHE_LOG_DIR}/wp.dhammikalalantha.com-access.log combined
     317</VirtualHost>
     318}}}
     319
     320Then enable the Apache rewrite module.
     321
     322{{{
     323sudo a2enmod rewrite
     324}}}
     325
     326Next verify the configuration changes for the Syntax errors and restart Apache to make changes effective.
     327
     328{{{
     329sudo apache2ctl configtest
     330sudo systemctl restart apache2
     331}}}
    260332
    261333== Moodle Installation ==