Below is a sample /etc/httpd.conf file which configures httpd to listen on port 80 and support PHP.
server "default" { listen on * port 80 root "/htdocs/" directory index "index.php" location "/*.php*" { fastcgi socket "/run/php-fpm.sock" } }
# pkg_add php 0: <None> 1: php-8.0.28p1 2: php-8.1.19 3: php-8.2.6 Your choice: 3
Once the installer finishes installing, you need to start httpd and php82_fpm (assuming you chose number 3, the latest release). You will also need to enable these daemons to start automatically when you boot OpenBSD.
# rcctl enable httpd php82_fpm # rcctl start httpd php82_fpm
Your new webserver is now up and running with PHP support. Below is a sample PHP script, you can name index.php and place in /var/www/htdocs
<?php phpinfo(); ?>
Now just point your browser to your internal ip address i.e, http://10.0.0.157 and you should see your new website.
Relevant pages that might be useful to you
Enable SSL/TLS on OpenBSD httpd
OpenBSD httpd tips and tricks
IPv6 website reachability test