Tutorial Index Page

Setting Up Apache on GhostBSD

GhostBSD includes Apache as a powerful web server for local development. This guide walks you through the essential changes to httpd.conf to get Apache running smoothly with PHP, HTML, CSS, and JavaScript files. No database required. Hostname: sion.

Key Changes to httpd.conf

# Set your hostname to avoid startup warnings
ServerName localhost

# Set your custom site directory
DocumentRoot "/usr/local/www/ghostbsd-site"


    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted


# Enable PHP support
LoadModule php_module libexec/apache24/libphp.so
AddHandler application/x-httpd-php .php
DirectoryIndex index.php index.html

# Enable MIME types for CSS and JS
AddType text/css .css
AddType application/javascript .js

# Enable useful modules
LoadModule mime_module libexec/apache24/mod_mime.so
LoadModule rewrite_module libexec/apache24/mod_rewrite.so
LoadModule dir_module libexec/apache24/mod_dir.so
LoadModule alias_module libexec/apache24/mod_alias.so

# Optional logging
ErrorLog "/var/log/httpd-error.log"
CustomLog "/var/log/httpd-access.log" common

Permissions

Optional: Virtual Hosts

If you plan to host multiple sites, enable virtual hosts and map each one in /etc/hosts. Example:


    ServerName ghostbsd.local
    DocumentRoot "/usr/local/www/ghostbsd-site"
    
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    

Then add to /etc/hosts:

127.0.0.1   ghostbsd.local

Final Tip

Create a phpinfo.php file to confirm PHP is working:

<?php phpinfo(); ?>

Visit http://localhost/phpinfo.php to verify your setup.

Feedback & Suggestions

If you spot any typos, unclear instructions, or areas for improvement, I’d love to hear from you. This project is built for GhostBSD users, by GhostBSD users—and your input helps shape it.