Create and manage sites

Before you start

Install native Homebrew Nginx and a compatible PHP version using Initial Environment Setup. Start Nginx and the corresponding PHP-FPM service in Services. PortCradle needs a recognized Nginx sites include and a usable PHP-FPM loopback listener or Unix socket. The Add Site sheet lists the eligible installations.

Choose a name such as demo.test. The default for new sites is port 18080. The stock Homebrew Nginx listener PortCradle sets up for a fresh install uses 8080. You can use 8080 for your site too. On the same Nginx server, different hostnames can share a port. Use Use as default for new sites to remember your choice.

The Sites screen with WordPress, Laravel, CodeIgniter and plain PHP sites, each card showing its .test address, PHP version, HTTPS state, database link and buttons for Review Configuration, Verify Site, Link Database and Site Options.
Each site gets a card in Sites with its address, PHP version and actions.

Register an existing project

  1. Open Sites → Add Site → Existing Project.
  2. Enter a name and select the Project folder and Document root. Choose the directory intended for browser requests, such as public for Laravel or CodeIgniter. The document root must be the project directory or a directory inside it.
  3. Enter the lowercase .test hostname. Optionally enter comma-separated .test aliases. Choose a loopback port, Nginx installation, and PHP runtime.
  4. Click Register Site and continue to Apply and verify the site.

For a quick PHP test, create a disposable folder and save this as index.php. Select the folder as both the project folder and document root.

<?php
echo 'PortCradle PHP check: ' . PHP_SAPI;

With Nginx routing requests through PHP-FPM, the browser should display PortCradle PHP check: fpm-fcgi.

The Add Site sheet on Existing Project, filled in: name setup-php, project folder, document root, hostname setup-php.test, loopback port 80, Nginx 1.31.10 and PHP 8.6, with a Register Site button.
Add Site → Existing Project: choose the folder and document root, then a .test hostname, port and PHP version.

Create a site from a starter

  1. Open Sites → Add Site and select WordPress, Laravel, or CodeIgniter 4.
  2. Choose an existing Parent folder and an unused New folder name. Enter a display name and .test hostname, and pick the port, Nginx installation, and PHP runtime. PortCradle uses the new project’s public folder as the document root.
  3. For Laravel or CodeIgniter, use Install Composer… if prompted and review the Homebrew changes. After installation, continue in the same Add Site form. Homebrew’s Composer package can bring in its own default PHP dependency. PortCradle runs the starter install with the PHP you select for that site.
  4. Click Create WordPress Site, Create Laravel Site, or Create CodeIgniter 4 Site. Wait for the download and setup before applying the configuration.

For WordPress, prepare a running MySQL or MariaDB server, an empty database, and a user with access to that database. PortCradle downloads WordPress from WordPress.org. After you apply the site configuration and open the site, complete the WordPress browser installer with your database details. For Laravel and CodeIgniter, configure database settings and run any needed migrations from the project.

The Add Site sheet on the WordPress starter, filled in: name, parent folder, new folder name, hostname setup-wordpress.test, port 80, Nginx and PHP 8.6, with a Create WordPress Site button.
Pick a starter tab, then a parent folder, a new folder name and a hostname.
The Add Site sheet on the Laravel starter, filled in for setup-laravel.test, noting that Composer downloads laravel/laravel with the selected PHP and Nginx serves the public folder.
Laravel and CodeIgniter starters use Composer with the PHP version you choose.
The Install Tool sheet with Composer 2.11.3 selected under Developer Tools.
No Composer yet? Install it from Install Tool → Developer Tools.

Apply and verify the site

  1. Review Configuration opens after successful registration or starter creation. Read the proposed Nginx server block and click Validate & Apply. You can reopen the review from the site card. PortCradle checks the assembled Nginx configuration and reloads the service if it is running.
  2. Select Verify Site on the card. PortCradle tests the named route with a temporary loopback override. An HTTP 2xx or 3xx result confirms a response on that route. For the PHP example above, open it in the browser and check for the fpm-fcgi text.
  3. Choose Site Options → Set Up Hostname to give the browser a system mapping for the .test address. Then use Open Site. It can also open the loopback IP when PortCradle verifies that the IP routes to this specific site.

If the card shows Configuration required, use Review Configuration and apply the changes before opening or verifying the site. If you receive an error, check that the selected Nginx and PHP-FPM are running and review Logs for the failed step. If Verify Site succeeds and the browser cannot resolve the name, complete hostname setup.

The Review Configuration sheet for setup-codeigniter.test, showing the generated Nginx server block with its listeners, certificate paths and project root, and a Validate & Apply button.
Review Configuration shows the Nginx server block. Validate & Apply tests it before reloading Nginx.

Set up the browser hostname

  1. On the card, choose Site Options → Set Up Hostname → Enable Hostname Helper if offered. This requires an Apple team-signed build. If macOS asks for background approval, click Open System Settings and allow PortCradle under General → Login Items & Extensions.
  2. Return to PortCradle, click Add Hostname, and approve the macOS administrator prompt if shown. The helper maps the primary hostname to 127.0.0.1. If the name already points elsewhere, review the conflicting entry before continuing.
  3. Click Check Hostname, then Open Site. For example, with port 18080 the browser address is http://demo.test:18080/. Any optional aliases you want to use in the browser need their own system mappings.
The Set Up Hostname sheet for http://setup-codeigniter.test:8080/, confirming that macOS resolves the hostname to 127.0.0.1, with Check Hostname and Open Site buttons.
Site Options → Set Up Hostname: when the check passes, open the site.
System Settings → General → Login Items & Extensions with PortCradle.app switched on.
If macOS asks, allow PortCradle in System Settings → General → Login Items & Extensions.

Change the port or use port 80

Use Site Options → Change Port… on the site card. Choose a port from Common Ports or enter a custom port, then click Change Port. PortCradle keeps the same site registration, backs up the configuration, validates the change, and reloads Nginx if running. Verify and open the new address.

For http://demo.test/ without a port in the address, choose 80 in Site Options → Change Port…. In Set Up Port 80, click Move Site to 8080 if offered. Apply the configuration and start Nginx, then choose Enable Port 80. Approve the helper in System Settings → General → Login Items & Extensions if asked. Click Check Again and complete Set Up Hostname if needed. The signed helper forwards loopback port 80 to Nginx on 8080 for sites using that listener.

The Change Site Port sheet for setup-codeigniter with the Common Ports menu open, offering 80, 8080 (Default) and 18080.
Site Options → Change Port…: type a port or choose one from Common Ports.
The Set Up Port 80 sheet: the macOS helper forwards loopback port 80 to Nginx on port 8080, and the hostname and port 80 route are verified.
Set Up Port 80 enables the helper, then checks the route.

Use trusted HTTPS

  1. Confirm the site works over HTTP and the hostname resolves to 127.0.0.1. Leave Nginx and PHP-FPM running.
  2. Choose Site Options → Set Up HTTPS… → Prepare HTTPS. PortCradle creates certificate material for the site and configures Nginx on loopback port 8443. The HTTP address remains available. If this site already uses 8443 for HTTP, move HTTP to another port first.
  3. Choose Trust Certificate and approve trust in macOS. If PortCradle offers Open Certificate in Keychain, use the login keychain, open that site certificate authority’s Trust section, and set Secure Sockets Layer (SSL) to Always Trust.
  4. Choose Enable Port 443 if offered. Approve the signed helper in System Settings if asked, then click Check HTTPS. The helper forwards loopback port 443 to Nginx on 8443.
  5. Choose Open HTTPS and check that https://demo.test/ opens without a certificate warning. If port 443 is occupied, identify the service using it before retrying.

Use Site Options → Manage HTTPS… → Remove Trust… to remove this site’s trust from your account. Settings → Disable Port 443… affects all sites using that forwarding helper. Disable Port 80… affects the shared HTTP forwarding helper.

A browser at setup-wordpress.test showing Connection is secure.
With trusted HTTPS, the browser shows the connection as secure.
The Set Up HTTPS sheet with a confirmation asking Remove This Site’s Certificate Trust?, with Remove Trust and Cancel buttons.
Manage HTTPS… → Remove Trust… removes the certificate trust for one site.

Choose Link Database… on the site card. Select MySQL, MariaDB, Percona Server, PostgreSQL, or SQLite. For a server, enter the database name, host and port or absolute socket path, and the optional username. For SQLite, enter an absolute database file path. Choose Link Existing when offered, then Save Link.

The site card shows the engine, database, endpoint, and username when supplied. Use Edit Database Link… to change the record or Remove Link to clear it. Set the connection and credentials in the project.

The Database Link sheet for setup-codeigniter.test with the Database engine menu open, listing MySQL, MariaDB, Percona Server, PostgreSQL and SQLite.
Link Database…: choose the engine, then enter the database name, endpoint and username.
The Sites screen with setup-codeigniter linked to MySQL database ci_db_testing on port 3306, and an Edit Database Link button on its card.
The site card then shows the engine, database and endpoint.

Create a database and login

Open Link Database… or Edit Database Link…, select MySQL or PostgreSQL, and choose Create & Link.

  1. Choose a running local server and enter a database name. If a compatible Homebrew client is missing, use the install button in the form. Review the formula and continue in the same form when the installation finishes. An empty endpoint uses 127.0.0.1:3306 for MySQL or 127.0.0.1:5432 for PostgreSQL. An absolute Unix socket path also works. PortCradle uses the client from a native Homebrew installation. Start MySQL from Services. In PostgreSQL’s Create & Link form, PortCradle starts the selected server on demand after an inline install and checks the form’s endpoint. For an installed server, click Start PostgreSQL. If the endpoint does not respond, check the displayed address and use Retry PostgreSQL Start. The form keeps your draft, and the server’s login startup policy is preserved.
  2. Enter a database administrator username and password. MySQL needs permission to create databases and accounts and to grant database privileges. PostgreSQL needs permission to create roles and databases and assign the new role as the database owner.
  3. Enter a different username and password for the new site login. MySQL grants access on the new database only. PostgreSQL creates a login role and makes it the new database’s owner. Use printable ASCII for the new PostgreSQL password.
  4. Click Create Database & Link. PortCradle checks the new login against the new database before saving the site link. Enter the new database name, username, password, and endpoint in your project or WordPress setup page.

PortCradle records the connection details and username. Passwords are used for the connection and cleared from the sheet when creation starts. If a database or account already exists, use Link Existing to record it or choose new names. If creation stops partway, check the resources named in the error before retrying.

The Database Link sheet on Create & Link for PostgreSQL: database name, host and port, an administrator login, and a new site username and password, with the passwords hidden.
Create & Link uses an administrator login to create the database and a new login for the site.

Remove a site

Use Site Options → Remove Site… on the card to remove the registration and the Nginx configuration PortCradle owns. It saves a backup and reloads Nginx if running. Project files, database data, and hostname mappings are preserved. Remove Registration Only keeps the existing Nginx files when app-managed cleanup is unavailable. If you also want to remove macOS certificate trust for this site, use Remove Trust… before removing the registration.

The Remove Site? confirmation for setup-php, explaining that the registration and PortCradle’s Nginx configuration are removed and project files, database data and hostname mappings are kept.
Remove Site removes the registration and PortCradle’s Nginx configuration. Your project files stay.