FreeBSD Basics: Apache, MariaDB, and PHP Part 1

FreeBSD and Apache


There are just a few differences between setting up an Apache server in FreeBSD compared with Linux. The following steps provide a basic overview of setting up Apache on FreeBSD 10.x.

1. Install the apache package using pkg or from the ports collection.

pkg search apache

pkg install <version>


In this example, the version apache24-2.4.23_1 is installed using pkg.



2. Add the line apache23_enable="yes" to /etc/rc.conf.

nano /etc/rc.conf

Add the following line:

apache24_enable="YES"

3. You can modify the default Apache web page at /usr/local/www/apache24/data/index.html.
nano /usr/local/www/apache24/data/index.html


4. Reboot the system or run service apache24 start.

service apache24 start

5. Check the status of the apache24 service.

service apache24 status

If you're working in a desktop environment, launch a browser and access http://localhost.


6. Modify httpd.conf as needed.

For this example, httpd.conf is located at /usr/local/etc/apache24/httpd.conf.

Note: The sample httpd.conf file is located in the same folder /usr/local/etc/apache24.

nano /usr/local/etc/apache24/httpd.conf

7. Verify configuration.

service apache24 configtest

8. Start and stop apache24 status.

service apache24 stop

service apache24 start


9. Verify VirtualHost access using a web browser if needed.

Continued in FreeBSD Basics: Apache, MariaDB, and PHP Part 2

Comments

Popular posts from this blog

Quick Fix: MS Office Click to Run and CPU usage

Notes on UPnP/DLNA media streaming with Windows 10

Vivosmart HR: Setting up Notifications and Music Controls Part 1