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


Ignore:
Timestamp:
Nov 22, 2022, 3:18:59 AM (2 years ago)
Author:
admin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Csle2022/Agenda/databaseandweb

    v10 v11  
    303303{{{
    304304<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>
     305    ServerName wp.your_domain.com
     306    ServerAlias wp.your_domain.com
     307    ServerAdmin webmaster@wp.your_domain.com
     308    DocumentRoot /var/www/wp.your_domain.com/public_html
     309
     310    <Directory /var/www/wp.your_domain.com/public_html>
    311311        Options -Indexes +FollowSymLinks
    312312        AllowOverride All
    313313    </Directory>
    314314
    315     ErrorLog ${APACHE_LOG_DIR}/wp.dhammikalalantha.com-error.log
    316     CustomLog ${APACHE_LOG_DIR}/wp.dhammikalalantha.com-access.log combined
     315    ErrorLog ${APACHE_LOG_DIR}/wp.your_domain.com-error.log
     316    CustomLog ${APACHE_LOG_DIR}/wp.your_domain.com-access.log combined
    317317</VirtualHost>
    318318}}}
     
    330330sudo systemctl restart apache2
    331331}}}
     332
     333Now that our server software is configured, we can download and set up WordPress. For security reasons in particular, it is always recommended to get the latest version of WordPress from their site.
     334
     335cd /tmp
     336curl -O https://wordpress.org/latest.tar.gz
     337
     338Extract the compressed file
     339
     340tar xzvf latest.tar.gz
     341
     342To enable Wordpress modify the directory content through the .htaccess file let's create the required file within the directory.
     343
     344touch /tmp/wordpress/.htaccess
     345
     346Then let's create a initial configuration file from a sample configuration given.
     347
     348cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
     349
     350We will also create the upgrade directory for WordPress as below.
     351
     352mkdir /tmp/wordpress/wp-content/upgrade
     353
     354Now we will copy entire content to the document root of WordPress site.
     355
     356cp -a wordpress/. /var/www/wp.your_domain.com/public_html/
     357
     358Now we will set the ownership settings of the WordPress directory to the Apache user.
     359
     360chown -R www-data:www-data /var/www/wp.your_domain.com
     361
     362Next we will set correct directory and file permissions for document root.
     363
     364find wp.your_domain.com/public_html/  -type d -exec chmod 750 {} \;
     365find wp.your_domain.com/public_html/  -type f -exec chmod 640 {} \;
     366
     367Now we are going to modify the configuration file we have added earlier. Here we will configure WordPress security keys and database connection settings.
     368
     369WordPress uses security keys to protect your website against hacking attempts. WordPress security keys are an encryption tool that protects login information by making it harder to decode. WordPress provides a secure generator for these keys to generate them use the below command.
     370
     371curl -s https://api.wordpress.org/secret-key/1.1/salt/
     372
     373[[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web24.png)]]
     374
     375These lines can be directly copied into the WordPress configuration file. Open configuration file and replace the existing sample keys with them.
     376
     377nano /var/www/wp.your_domain.com/public_html/wp-config.php
     378
     379Now we will add the database connection settings as below.
     380
     381{{{
     382// ** MySQL settings - You can get this info from your web host ** //
     383/** The name of the database for WordPress */
     384define( 'DB_NAME', 'wordpress' );
     385
     386/** MySQL database username */
     387define( 'DB_USER', 'wordpressuser' );
     388
     389/** MySQL database password */
     390define( 'DB_PASSWORD', '********' );
     391
     392/** MySQL hostname */
     393define( 'DB_HOST', 'localhost' );
     394
     395/** Database Charset to use in creating database tables. */
     396define( 'DB_CHARSET', 'utf8' );
     397
     398/** The Database Collate type. Don't change this if in doubt. */
     399define( 'DB_COLLATE', '' );
     400}}}
     401
     402The other change we need to make is to set the method that WordPress should use to write to the filesystem. Since we’ve given the web server permission to write where it needs to, we can explicitly set the filesystem method to “direct”.
     403
     404define('FS_METHOD', 'direct');
     405
     406Now we are done with configuration of the WordPress.  To begin the installation you have to access the WordPress URL from the web browser. Enter the http://wp.your_domain.com/ on the browser and we need to follow the steps as below.
     407
     408[[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web18.png)]]
     409
     410[[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web19.png)]]
     411
     412[[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web20.png)]]
     413
     414[[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web21.png)]]
     415
     416[[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web22.png)]]
     417
     418[[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web23.png)]]
     419
    332420
    333421== Moodle Installation ==