How To Install Wordpress With Apache On FreeBSD 12

How To Install Wordpress With Apache On FreeBSD 12

This blog post is showing you how to install apache, php and mysql 8 (LAMP) on FreeBSD 12. After having LAMP installed, you can install wordpress. Installing wordpress with apache on FreeBSD 12 is not a hard task. To do so, follow these steps.

1. Install apache.

To do so, type following command lines and hit enter.

sudo pkg install apache24

2. Enable apache.

To do so, type following command lines and hit enter.

sudo sysrc apache24_enable=yes

3. Start apache./p>

To do so, type following command lines and hit enter.

sudo service apache24 start

4. Check status of the apache.

To do so, type following command lines and hit enter.

sudo service apache24 status

5. Visit "http://ip_address" using a web browser. You should see "It Works!" page.

How To Install Wordpress With Apache On FreeBSD 12

6. Install mysql server.

To do so, type following command lines and hit enter.

sudo pkg install mysql80-server

7. Enable mysql server.

To do so, type following command lines and hit enter.

sudo sysrc mysql_enable="YES"

8. Start mysql server.

To do so, type following command lines and hit enter.

sudo service mysql-server start

9. Check status of the mysql server.

To do so, type following command lines and hit enter.

sudo service mysql-server status

10. Secure mysql server.

To do so, type following command lines and hit enter.

sudo mysql_secure_installation

Then the following security option will be prompted.

  • Would you like to setup VALIDATE PASSWORD component? --> Enter.
  • Press y|Y for Yes, any other key for No: ---> Y.
  • Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: ---> 2 (100).
  • Now set your new password.
  • When the Estimated strength of the password: 100, You may continue using this password.
  • Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : ---> Y.
  • Remove anonymous users? (Press y|Y for Yes, any other key for No) : --> Y.
  • Disallow root login remotely? (Press y|Y for Yes, any other key for No) : --> Y.
  • Remove test database and access to it? (Press y|Y for Yes, any other key for No) : --> Y.
  • Reload privilege tables now? (Press y|Y for Yes, any other key for No) : --> Y.

Below is recommended mysql database server installation's security options.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: Y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2


Please set the password for root here.

New password:

Re-enter new password:

Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

11. Install PHP.

To do so, type following command lines and hit enter.

sudo pkg install php73 php73-mysqli mod_php73 php73-json

12. Create php.ini file.

To do so, type following command lines and hit enter.

sudo cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini

13. Create apache configuration so that php can run on apache server called 001_mod-php.conf.

To do so, type following command lines and hit enter.

sudo nano /usr/local/etc/apache24/modules.d/001_mod-php.conf

14. Write the following lines inside of it.

<IfModule dir_module>
    DirectoryIndex index.php index.html
    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
</IfModule>

15. Create info.php file

nano /usr/local/www/apache24/data/info.php

16. Write the following lines inside of it.

<?php phpinfo() ?>

17. Visit "http://ip_address/info.php" using a web browser.

How To Install Wordpress With Apache On FreeBSD 12

18. Login into your database server.

To do so, type following command lines and hit enter.

mysql -uroot -p

19. Create database name.

To do so, type following command lines and hit enter.

create database wpfreebsd12;

20. Create database user.

To do so, type following command lines and hit enter.

CREATE USER 'wpuserfreebsd12'@'localhost' IDENTIFIED WITH sha256_password BY 'Gle48erGRrr*&#';

21. Grant all privileges of the database user on the database name.

To do so, type following command lines and hit enter.

GRANT ALL PRIVILEGES ON wpfreebsd12.* TO 'wpuserfreebsd12'@'localhost';

22. Download wordpress.

To do so, type following command lines and hit enter, one by one.

cd /var/www/html
wget http://wordpress.org/latest.zip

23. Extract latest.zip.

To do so, type following command lines and hit enter.

unzip latest.zip

24. Copy the wordpress app to the root directory.

To do so, type following command lines and hit enter.

sudo cp -r wordpress /usr/local/www/apache24/data/

25. Now Navigate to "http://ip_address" in web browser to start installing wordpress app.

How To Install Wordpress With Apache On FreeBSD 12

Hit "Let's Go" button.

26. Place the database you have just created into the following page. Then press "submit" button.

  • Database Name --> Put your database name here.
  • Username --> Put your database username here.
  • Password --> Put your database password here.

How To Install Wordpress With Apache On FreeBSD 12

27. Create wp-config.php based on the following page And click "run the installation".

How To Install Wordpress With Apache On FreeBSD 12

After the text : "You can create the wp-config.php file manually and paste the following text into it", you will find the wp-config.php you have to create.

Below is the example of wp-config.php.

<?php
/**
 * The base configuration for WordPress
 *
 * The wp-config.php creation script uses this file during the
 * installation. You don't have to use the web site, you can
 * copy this file to "wp-config.php" and fill in the values.
 *
 * This file contains the following configurations:
 *
 * * MySQL settings
 * * Secret keys
 * * Database table prefix
 * * ABSPATH
 *
 * @link https://codex.wordpress.org/Editing_wp-config.php
 *
 * @package WordPress
 */

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wpdatabase' );

/** MySQL database username */
define( 'DB_USER', 'wpuser' );

/** MySQL database password */
define( 'DB_PASSWORD', 'Cwo48*&#' );

/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */

define('AUTH_KEY',         'b&pCKl@v)?,Pw[BY#uaU^?rJI8p9u5/>`nU/:C9AWIRA27KwRG?!#-}`t6Y`Y+nn');
define('SECURE_AUTH_KEY',  '[a6tJ(2`sxm![v2HdW!k72+ZV~^Wu:TP8R-[4{~H|]HWJTE%6&:GC7n3U)yITPsF');
define('LOGGED_IN_KEY',    'xn@V/-c3>0i%z}wV5`R-|GL/e>C4dMYlIWH>-oKmc=P [#QFOv}O-^%@ajz0-h<`');
define('NONCE_KEY',        'MxFMeyczY:zi7r98k(wg_,5J^o+yumK smFrPIlQ~2fZeEbjg+t*1IfDXD(%gh$-');
define('AUTH_SALT',        '||zuN%h-*wgEBk<V|aVA_K8fkR@31t8M<9Sq&O X5<vZw4FnvU^u@!-|H`L`1!Wh');
define('SECURE_AUTH_SALT', 'e-C)g5=e5!)Q_B@71^v<r%+ * 1r-[u&XrMf`T@x!`(.%te|GM-MH[FH>Os>n-z~');
define('LOGGED_IN_SALT',   '?W9YVziA8]mMSt,7&16hbbg QDN:7Ip TM/J[Kzeu4/;eA$L{LT9}@#^_X:Je!WV');
define('NONCE_SALT',       '[PWqef,WJ3*i 1:1[Mup9%`1?^XUIjaO2D!|+c!HAhZ{.DbObb$b4}+BWl|*s@}T');

/**#@-*/

/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each
 * a unique prefix. Only numbers, letters, and underscores please!
 */
$table_prefix = 'wp_';

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 *
 * For information on other constants that can be used for debugging,
 * visit the Codex.
 *
 * @link https://codex.wordpress.org/Debugging_in_WordPress
 */
define( 'WP_DEBUG', false );

/* That's all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
    define( 'ABSPATH', dirname( __FILE__ ) . '/' );
}

/** Sets up WordPress vars and included files. */
require_once( ABSPATH . 'wp-settings.php' );

28. Provide the information about your blog: Site title, Username, Password and Your Email. Fill out the information and click "Install Wordpress."

How To Install Wordpress With Apache On FreeBSD 12

29. If the installation of wordpress app succeed, you can login to wordpress admin using the username and password you have provided.

How To Install Wordpress With Apache On FreeBSD 12

How To Install Wordpress With Apache On FreeBSD 12

Tags :