FrontierStack User Manual Manual home
Desktop Manual Mobile Manual 日本語 frontierstack.app ↗

Part II

II

Running Services

Running the web stack, databases, the service catalog and your sites on the Mac in front of you.

4

Chapter 4

The Web Stack

Apache or Nginx, the PHP version each site needs, virtual hosts, trusted local HTTPS and DNS — the whole web stack, controlled from one window with no hand-edited config.

A web server is the heart of most self-hosted setups, so FrontierStack treats it as a first-class citizen. The Apache pane installs, starts, validates and configures a Homebrew Apache; the PHP, Localhost, Certificates and DNS panes round out a complete development and hosting stack — and every change goes through validation so a typo never takes a site down silently.

This chapter covers the panes that make and run web sites on the Mac in front of you. Connecting that stack to a real domain and the public internet is Chapter 7; tightening it for production is Chapter 10.

4.1The Apache pane

Open the Apache pane from the sidebar to see your web server’s state at a glance: version, whether it is running, and the ports it listens on. The buttons across the top are the controls you reach for daily — Start, Stop, Restart and Validate Config. Validation runs apachectl -t (a real syntax check) and shows the result in Last Result, so you can confirm a change is sound before you reload.

FrontierStack recommends a Homebrew Apache rather than the macOS system copy. The Homebrew server lives under /opt/homebrew (or /usr/local on Intel Macs), runs as you through brew services without a root prompt for every action, and is not locked down by System Integrity Protection — so a current mod_php loads cleanly and the whole stack stays on one toolchain. The system Apache under /etc/apache2 is wiped by OS updates and ties you to Apple’s bundled libphp. If Homebrew Apache is not installed, the pane offers Install Homebrew Apache… in one click.

If you keep several Apache builds — the Homebrew one, a legacy local build, or a remote server’s — the binary picker (see Add Homebrew Apache / Add Local Build…) lets you register and switch between them, each with its own version and ports shown.

NoteAll of FrontierStack’s own additions to Apache live in an app-managed config tree at /opt/homebrew/etc/httpd/frontierstack/, pulled in by an IncludeOptional from httpd.conf. Keeping the app’s vhosts, MIME types and managed includes there means your hand-written httpd.conf stays clean and you can always tell what FrontierStack added.

4.2Modules, ports and the managed config

Lower in the Apache pane are the parts of the config you most often edit, each surfaced as a control rather than a file:

SectionWhat it does
PortsSet the HTTP and SSL listen ports (default 80 and 443). Move Apache off 80/443 if Nginx is using them. Apply rewrites the Listen directives and reloads.
Apache Modules (Modules…)List loaded modules and enable or disable them. Disabling an unused module is the simplest hardening step you can take.
PHP ModuleChoose which version’s mod_php (libphp.so) Apache loads for websites — see the next section.
WebDAVEnable mod_dav for a shared folder, with optional Basic-auth user, written into a managed include.
Edit MIME Types…Add or remove AddType mappings in a FrontierStack-managed MIME file, never touching the distro’s mime.types.

For anything not exposed as a control, the config rows give you Edit Managed Config… (the FrontierStack include) and Edit httpd.conf… (the main file) directly. Every save validates with apachectl -t, reloads gracefully, and rolls back if the new config does not parse — so a bad edit is caught before it can break the running server.

WarningEditing httpd.conf by hand is powerful and unguarded. The app validates and rolls back on a syntax error, but a config that parses yet points a document root at the wrong place can still expose files. Prefer the managed include for FrontierStack’s own additions, and keep a copy of any large change.

Toggling a module rewrites its LoadModule line and revalidates. If a change leaves httpd -t failing — the classic case is enabling proxy_fcgi without proxy, which the app now auto-enables for you — the Modules window shows the error and won’t close silently: you either correct it or choose Save anyway. When Apache is wedged and won’t start (the classic Homebrew Bootstrap failed: 5: Input/output error, from a service that was already loaded, or from sudo brew services leaving some httpd paths owned by root), the pane’s Recovery & reset section offers three escalating fixes: Restart cleanly (stops httpd in both the user and system launchd domains, then starts it once), Reset config to default (backs up your httpd.conf and restores Homebrew’s), and Remove & Reinstall (clears the root-owned paths and reinstalls the formula). All run in the in-app console so you see the sudo prompt and output. If Service Watchdog keep-alive is also on for Apache, it may restart httpd on its own — expected, but pause it if it fights a manual recovery.

4.3Choosing the PHP version

Open the PHP pane to manage the PHP runtimes installed on the Mac. Homebrew lets several major versions live side by side (for example [email protected] through the current release), and FrontierStack treats them as a set you switch between rather than a single global install.

There are two distinct choices:

  • The Apache module. In the Apache pane’s PHP Module section, the Load for websites picker chooses which version’s libphp.so Apache loads. Changing it rewrites the managed config and reloads Apache.
  • Per-site PHP. A local dev server (the Localhost pane, below) has its own PHP Version and PHP Binary fields, so one project can run on an older PHP while another runs on the latest — without changing what the rest of the machine uses. This is the usual way to keep a legacy app and a new one happy at the same time.

The Runtime Health pane gives the wider picture — PHP alongside Python, Node.js, Java, Go, Rust, Ruby, Perl and .NET — with a self-check that flags a missing or end-of-life runtime before it bites you.

The Runtimes section also carries a React pane for front-end work. It scaffolds a new app (Vite, TanStack Start or Next.js), points at any React project, and offers a curated companion-library list filed by the job each does — state management (Zustand, Jotai, Redux Toolkit), data fetching and server state (TanStack Query — the library formerly called React Query — and SWR), full-stack frameworks (TanStack Start, Next.js), routing, validation (ArkType, Zod), forms, and authentication (Clerk). Each row shows its docs, whether the selected project already uses it, and a one-click npm install into that project.

4.4Sites and virtual hosts

The Websites list in the Apache pane is where you manage virtual hosts. Each row shows the site’s name, the bind address and the port (for example :8080), and a Running toggle for its live status. The buttons let you Add Site…, edit, duplicate, disable, Push to Server… (copy a vhost to a linked server), and open the site in a browser. Import Sites… and Copy from… pull existing vhosts in from MAMP, XAMPP, Apple’s Server.app or another Apache, bound to localhost by default.

Adding or editing a site, you set the essentials a vhost needs: its ServerName (the domain), the document root (Choose… a folder), and the bind address and port. Enable the site and it appears in the list with a live status dot; FrontierStack writes the vhost into a .conf file under the managed tree, validates, and reloads. To create the vhost, certificate and a Cloudflare DNS record together, use New Site + DNS… — the one-flow wizard described in Chapter 7.

screenshot to be added
Figure 4.1. A virtual host’s settings: ServerName, document root, bind address and port, with TLS and PHP options.Capture: open the Apache pane, select a site in the Websites list, and show its settings editor with ServerName and document root filled in
TipBind a site to 127.0.0.1 while you develop and it is reachable only from your Mac — the safest default for work in progress. Move the bind address to 0.0.0.0 or a LAN IP only when you genuinely want other machines to reach it.

4.5TLS certificates for sites

The Certificates pane issues and manages the certificates that put the padlock on your sites. It offers three paths, suited to different needs:

MethodUse it for
mkcert (Get Certificate (mkcert))Trusted local HTTPS. mkcert installs a local certificate authority your Mac trusts, so https://myapp.test works with no browser warning — ideal for development. Install mkcert sets it up first.
Let’s Encrypt (ACME)Public, browser-trusted certificates for real domains, via acme.sh or certbot. Issue by webroot (the domain already serves HTTP) or by DNS-01 via Cloudflare (no inbound HTTP needed). Renew All Now and a renew cron keep them current.
Create Self-Signed CertificateA quick certificate for internal or testing use where a browser warning is acceptable.

Once issued, Deploy to Apache wires the certificate into the site’s vhost. The Expiry Monitoring section watches your certificates (and any domain you add with Watch) and alerts you well before they lapse — the deeper hardening story, including HSTS and modern cipher policy, is in Chapter 10.

Securitymkcert’s local CA is trusted only by the Mac it runs on, and Let’s Encrypt certificates are real public certificates — never use a self-signed certificate for a site the public will visit. The Cloudflare API token for DNS-01 issuance is stored as a CF_TOKEN vault secret and injected at run time; it is never sent to a cloud AI.

4.6The .htaccess editor

Per-directory Apache rules — rewrites, redirects, access control — live in .htaccess files, and FrontierStack gives them a dedicated editor with line numbers and a syntax sanity check. Open a site’s document-root .htaccess with Use Site Root, or point it at a custom path. Insert Recipe drops in common, correct snippets (a front-controller rewrite, a force-HTTPS block) so you start from working rules rather than memory, and the editor flags obvious problems before you save. Export PHP Router… turns .htaccess rewrite rules into a router file for a built-in PHP dev server — useful when you move a site to the Localhost pane.

4.7Nginx and reverse proxies

FrontierStack manages Nginx as an alternative web server or a reverse proxy in front of an app. When both are installed, the Domains view groups your sites by server — Apache virtual hosts and Nginx server blocks side by side — reading each Nginx server block’s listen port, root and TLS state. A reverse proxy is the standard pattern for fronting an application that speaks HTTP on a high port (a Node, .NET or Python service): Nginx terminates TLS on 443 and forwards to the app. Because Apache and Nginx both want 80/443 by default, use the Apache pane’s Ports section to move one off those ports if you run them together.

4.8Localhost, DNS and dev stacks

Three more panes complete the local picture:

  • Localhost — a manager for ad-hoc local dev servers. Add a New Local Server, pick a Runtime (PHP, Python/Django, Node/Vite…) and folder, set a port and an optional ServerName, and Start it — with per-server Environment Globals and a .test resolver so myapp.test resolves locally. A Free Port helper and a stop whatever is holding localhost action clear the usual conflicts.
  • DNS — local name resolution and authoritative hosting. Run dnsmasq, unbound or nsd; import and export zone files; and flush the resolver when records change so the Mac stops serving a stale answer.
  • LAMP / DevStacks — one-click stacks. The LAMP pane offers presets (Choose a Setup) that install and start a matched set of components together (Install & Start, Start All, Stop All); DevStacks detects the framework of a project folder and shows the right commands and npm scripts to run it.

An Localhost overview shows every local server you have running, side by side, so you can run many sites at once without a wall of Terminal windows to babysit.

The same tools the AI uses
Everything in this chapter is also available to the AI Administrator (Chapter 13) and to outside AI tools over MCP (Chapter 14) through the same guarded actions: vhost_create makes a virtual host, reload_webserver tests and gracefully reloads Apache or Nginx, and issue_certificate obtains a Let’s Encrypt certificate. They are mutating tools, so each shows an approval card and requires changes to be enabled — the AI does exactly what you would do in these panes, and nothing it has not been allowed to.

FrontierStack User Manual · Version 1.0.0 · Chapter 4