Grav Built-in Web Server
For the fastest way to get Grav up and running, you can run Grav using a simple command from Terminal / Command Prompt using the built-in PHP server available as long as you have PHP installed.
All you need to do is navigate to the root of your Grav install using the Terminal or Command Prompt and enter bin/grav server.
Caution
While technically all you need is PHP 8.3 or newer, if you install the Symfony CLI application the server runs PHP-FPM for better performance, picks the PHP version from Grav's composer.json, and can serve https:// once you have run symfony server:ca:install to trust its local certificate authority. Without the Symfony CLI, bin/grav server falls back to PHP's built-in server with system/router.php.
Entering this command will present you with output similar to the following:
➜ bin/grav server
Grav Web Server
===============
Following Web Server log file (/Users/joeblow/Library/Application Support/symfony-cli/log/767450c93509862b00bb0ec5c4e8c80896f77798.log)
Following PHP-FPM log file (/Users/joeblow/Library/Application Support/symfony-cli/log/767450c93509862b00bb0ec5c4e8c80896f77798/53fb8ec204547646acb3461995e4da5a54cc7575.log)
[WARNING] The local web server is optimized for local development and MUST never be used in a production setup.
[OK] Web server listening
The Web server is using PHP FPM 8.3.37
https://127.0.0.1:8000
[Web Server ] Dec 4 07:49:57 |DEBUG | PHP Reloading PHP versions
[Web Server ] Dec 4 07:49:57 |DEBUG | PHP Using PHP version 8.3.37 (from composer.json from current dir: /Users/joeblow/sites/grav/composer.json)
[Web Server ] Dec 4 07:49:57 |INFO | PHP listening path="/opt/homebrew/Cellar/[email protected]/8.3.37/sbin/php-fpm" php="8.3.37" port=57156
[PHP-FPM ] Dec 4 07:49:57 |NOTICE | FPM fpm is running, pid 94065
[PHP-FPM ] Dec 4 07:49:57 |NOTICE | FPM ready to handle connections
Your terminal will also give you real-time updates of any activity on this ad hoc-style server. You can copy the URL provided in the [OK] Web server listening line and paste that into your browser of choice to access your site, including the admin at /admin if Admin2 is installed.
https://127.0.0.1:8000
Tip
This is a useful tool for quick development, and should not be used in place of a dedicated web server such as Apache or Nginx.
To specify a different port than the default 8000, use the -p option. For example, to set the port to 8001:
➜ bin/grav server -p 8001