---
title: "How to deploy Neos websites"
version: "main"
source: "Examples/Neos/Index.rst"
rendered: "2026-09-24T07:51:28+00:00"
---

# How to deploy Neos websites {#how-to-deploy-neos-websites}

If you would like to deploy a Neos website a good starting point is to use the Neos Application class provided by Surf:

```php
<?php
/** @var \TYPO3\Surf\Domain\Model\Deployment $deployment */

$node = new \TYPO3\Surf\Domain\Model\Node('production');
$node
   ->setHostname('my.node.com')
   ->setDeploymentPath('/var/www/html/my.node.com')
   ->setOption('username', 'myuser');

$application = new \TYPO3\Surf\Application\Neos\Neos('My Node');
$application
   ->setOption('keepReleases', 3)
   ->setOption('composerCommandPath', 'composer')
   ->setOption('repositoryUrl', '<my repository url>')
   ->setOption('branch', 'main')
   ->setOption('updateMethod', null)
   ->setOption('baseUrl', 'https://my.node.com')
   ->setOption('flushCacheList', [
       'Neos_Fusion_Content',
       'Neos_Neos_Fusion'
   ])
   ->addNode($node);

$deployment
   ->addApplication($application)
   ->onInitialize(
      function () use ($deployment, $application) {
            $deployment->getWorkflow()
               ->beforeStage('transfer', \TYPO3\Surf\Task\Php\WebOpcacheResetCreateScriptTask::class)
               ->afterStage('switch', \TYPO3\Surf\Task\Php\WebOpcacheResetExecuteTask::class)
               ->afterStage('switch', \TYPO3\Surf\Task\Neos\Flow\FlushCacheListTask::class);
      }
   );
```
