| 246 | WordPress 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 | |
| 248 | If 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 | |
| 250 | WordPress 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 | |
| 252 | First login the MySQL server, |
| 253 | |
| 254 | {{{ |
| 255 | mysql -u root -p |
| 256 | }}} |
| 257 | |
| 258 | Then create the database. |
| 259 | |
| 260 | {{{ |
| 287 | }}} |
| 288 | |
| 289 | === Install additional PHP extensions === |
| 290 | |
| 291 | WordPress 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 | {{{ |
| 294 | sudo apt update |
| 295 | sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip |
| 296 | sudo systemctl restart apache2 |
| 297 | }}} |
| 298 | |
| 299 | === Allow Apache’s .htaccess to Handle Override and Rewrite Rules on the WordPress Site === |
| 300 | |
| 301 | In 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 | |
| 320 | Then enable the Apache rewrite module. |
| 321 | |
| 322 | {{{ |
| 323 | sudo a2enmod rewrite |
| 324 | }}} |
| 325 | |
| 326 | Next verify the configuration changes for the Syntax errors and restart Apache to make changes effective. |
| 327 | |
| 328 | {{{ |
| 329 | sudo apache2ctl configtest |
| 330 | sudo systemctl restart apache2 |
| 331 | }}} |