How to install Neos on nixOS latest

Introduction

Neos is a modern, open source content management system that is capable of managing and publishing content on various platforms. In this tutorial, we will guide you through the installation process of Neos on nixOS latest.

Prerequisites

  • A nixOS latest server with a non-root user with sudo privileges.
  • A web server such as Nginx or Apache.
  • PHP version 7.2 or later.
  • Composer, a PHP package manager installed on your system.

Step 1: Update System

The first step is to update the system package repository using the following command.

$ sudo nix-channel --update

Step 2: Install Web Server and PHP

NixOS comes with various web servers and PHP versions in its repository. In this tutorial, we will install Nginx and PHP 7.4 using the following command.

$ sudo nix-env -iA nixos.nginx nixos.php74

Step 3: Install Composer

Composer is a PHP package manager used to manage dependencies. Run the following commands to install Composer.

$ cd /tmp
$ sudo curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer

Step 4: Install Neos

In this step, we will download and install Neos using composer. Follow these commands to download and install Neos.

$ cd /var/www
$ sudo composer create-project --no-dev neos/neos-base-distribution neos

Step 5: Configure Nginx for Neos

We will create a new virtual host configuration file for Neos in Nginx. Execute the following command to create a new configuration file.

$ sudo nano /etc/nginx/sites-available/neos.conf

Paste the following code block into the configuration file.

server {
    listen 80;
    server_name your_domain.com;

    root /var/www/neos/Web;

    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        try_files $uri /index.php =404;
        fastcgi_pass unix:/var/run/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

Save and close the configuration file. Verify the configuration syntax by running the following command.

$ sudo nginx -t

Lastly, enable the virtual host by creating a symlink in the sites-enabled directory.

$ sudo ln -s /etc/nginx/sites-available/neos.conf /etc/nginx/sites-enabled/neos.conf

Step 6: Restart Services

To apply changes we need to restart Nginx and PHP services.

$ sudo systemctl restart php-fpm
$ sudo systemctl restart nginx

Step 7: Access Neos Dashboard

Finally, access Neos Dashboard by typing the IP address or domain name of your server in the browser.

http://your_ip_address/

Conclusion

Congratulations, you have successfully installed Neos on nixOS latest. You can now begin creating and publishing content using Neos.