How to install NEOS CMS with Nginx on Ubuntu 24.04

This article provides a comprehensive guide to installing NEOS CMS with Nginx on Ubuntu 24.04. It covers setting up Nginx, MariaDB, PHP-FPM, downloading NEOS files, configuring the database, and setting up the web server with SSL/TLS. The tutorial is a complete resource for setting up a secure and efficient NEOS environment on Ubuntu.

This article explains installing NEOS CMS with Nginx support on Ubuntu 24.04.

Installing NEOS CMS with Nginx on Ubuntu is an excellent choice for several reasons. Nginx is a high-performance web server that works seamlessly with NEOS CMS to handle web requests efficiently.

The combination of NEOS CMS and Nginx on Ubuntu ensures your content management system operates smoothly and reliably.

Nginx’s configuration options and performance capabilities make it an excellent choice for serving NEOS CMS, providing a secure and efficient environment for your web operations.

Install Nginx HTTP server on Ubuntu

NEOS CMS requires a web server. This post will install and use the Nginx web server to run NEOS.

To do that, open the Ubuntu terminal and run the commands below to install the Nginx web server.

sudo apt update
sudo apt install nginx

Once Nginx is installed, the commands below can start, stop, and enable the Nginx web server to start automatically when your server boots up.

sudo systemctl stop nginx
sudo systemctl start nginx
sudo systemctl enable nginx

You can test the Nginx web server by opening your web browser and browsing to the server’s localhost or IP address.

http://localhost

When you see the “Welcome to nginx!” page, it means the Nginx HTTP server is successfully installed.

Additional help on installing Nginx on Ubuntu is in the link below.

How to install Nginx on Ubuntu

Install the MariaDB database server on Ubuntu

The next component required to run NEOS is a database server. This post will install and use the MariaDB database server.

To install and use the MariaDB database server, use the instructions below.

Open the Ubuntu terminal and run the commands below to install the MariaDB database server.

sudo apt update
sudo apt install mariadb-server

Once the MariaDB database server is installed, use the commands below to stop, start, and enable the MariaDB server to start automatically when the server boots.

sudo systemctl stop mariadb
sudo systemctl start mariadb
sudo systemctl enable mariadb

Run the following commands to validate and test if the MariaDB database server is installed successfully.

sudo mariadb

Once you run the commands above, it will log you onto the MariaDB console and display a message similar to the one below.

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 32
Server version: 10.11.2-MariaDB-1 Ubuntu 23.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 

The message tells you that the server is installed successfully.

Additional help on installing MariaDB.

Create a NEOS database

Upon successfully installing the MariaDB database server, create a blank database on the server specifically for the NEOS application.

As part of the setup, we will create a neosdb database and a user account called neosdbuser.

Finally, we’ll grant the neosdbuser full access to the neosdb database.

All the database steps above can be done using the commands below:

But first, log on to the MariaDB database server:

sudo mariadb

Then run the commands below to complete the steps:

CREATE DATABASE neosdb CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER neosdbuser@localhost IDENTIFIED BY 'type_your_password_here';
GRANT ALL ON neosdb.* TO neosdbuser@localhost WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit

Ensure to replace ‘type_your_password_here ‘with your password.

Install PHP-FPM on Ubuntu Linux

The last component you will need to run NEOS is PHP-FPM. The NEOS application is PHP-based and supports the latest versions of PHP-FPM.

Then, run the commands below to install the latest PHP-FPM version.

sudo apt install php-fpm php-intl php-mysql php-curl php-cli php-zip php-xml php-gd php-common php-mbstring php-xmlrpc php-bcmath php-json php-sqlite3 php-soap php-zip php-imap php-redis php-snmp php-imagick imagemagick

Additional help on installing PHP

How to install PHP on Ubuntu Linux

Download NEOS files

Let’s begin downloading and configuring the NEOS files on Ubuntu Linux.

First, install Composer, Curl, and other dependencies.

sudo apt install curl git
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

First, close NEOS files into the /var/www/neoscms directory. Next, make Nginx the owner of the neoscms folder. Then, change to the neoscms folder and install updates using Composer.

sudo git clone https://github.com/neos/neos-base-distribution.git /var/www/neoscms
sudo chown -R www-data:www-data /var/www/neoscms
cd /var/www/neoscms
sudo -u www-data composer install

After running the command above, set up the NEOS CMS database and account created above.

Note: For unknown reasons, I had to run the command twice by using the up arrow key to resolve “Access denied for user ”@’localhost’.

sudo -u www-data ./flow setup:database

When prompted, type in the database info created above.

DB Driver (mysqli): 
[pdo_mysql] MySQL/MariaDB via PDO
[mysqli ] MySQL/MariaDB via mysqli
> mysqli
Host (127.0.0.1):
Database: neosdb
Username: neosdbuser
Password: type_strong_password_here

Database neosdb was connected sucessfully.

Neos:
Flow:
persistence:
backendOptions:
driver: mysqli
host: 127.0.0.1
dbname: neosdb
user: neosdbuser
password: type_strong_password
The new database settings were written to /var/www/neoscms/Configuration/Development/Settings.Database.yaml

Next, set up the default image handler in the same directory.

sudo -u www-data ./flow setup:imagehandler

When prompted, choose Imagick driver as the PHP module.

  [Gd     ] GD Library - generally slow, not recommended in production
[Imagick] ImageMagick php module
> ImageMagick php module

Neos:
Imagine:
driver: Imagick

Migrate the database by running the command below.

sudo -u www-data ./flow doctrine:migrate

Create an administrator account.

sudo -u www-data ./flow user:create --roles administrator

When prompted, create an administrator account.

Please specify the required argument "username": superadmin
Please specify the required argument "password": strong_password_here
Please specify the required argument "firstName": Super
Please specify the required argument "lastName": Admin
The role Neos.Neos:administrator does not exist.

Finally, complete the setup.

sudo -u www-data ./flow neos.flow:cache:flush
sudo -u www-data ./flow site:import --package-key Neos.Demo
sudo -u www-data ./flow neos.flow:doctrine:compileproxies

Once you have completed all the above steps, continue configuring the Nginx web server below to serve the NEOS content.

Run the commands below to create a Nginx server block file for NEOS.

sudo nano /etc/nginx/sites-available/neoscms.conf

Then, copy and paste the content block below into the Nginx server block.

server {
listen 80;
listen [::]:80;
root /var/www/neoscms/Web;
index index.php;
server_name neoscms.example.com;

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

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

Save the file.

Then, run the commands below to enable the virtual host and restart the Nginx server.

sudo ln -s /etc/nginx/sites-available/neoscms.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx.service

Setup Let’s Encrypt SSL/TLS for NEOS

You may want to install an SSL/TLS certificate to secure your NEOS site. Secure your NEOS installation with HTTPS from Let’s Encrypt.

Please read the post below for additional resources on installing and creating Let’s Encrypt SSL certificates for Nginx.

How to set up Let’s Encrypt SSL certificate for Nginx on Ubuntu Linux

Once you have restarted the Nginx web server, open your browser and browse to the server hostname or IP address defined in the Nginx server block.

http://neoscms.example.com/

Your NEOS site should be set up and ready to use.

That should do it!

Conclusion

After following these steps, you have successfully installed NEOS CMS with Nginx support on Ubuntu 24.04, ensuring a robust and efficient setup for your content management system. Here’s a summary of what you accomplished:

  • Installed and configured Nginx as the high-performance web server to seamlessly handle web requests for NEOS CMS.
  • Set up the MariaDB database server and created a dedicated database for the NEOS application, ensuring optimal data management.
  • Installed PHP-FPM to support the PHP-based NEOS application and its latest features.
  • I downloaded and configured NEOS files and set up the NEOS CMS database and administrator account for seamless operation.
  • Configured the Nginx web server to serve NEOS content and optionally implemented Let’s Encrypt SSL/TLS for enhanced security.

With these components in place, your NEOS CMS installation on Ubuntu is ready for use, providing a secure, high-performance environment for your web operations.

Richard Avatar

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *