PyroCMS is a powerful open-source content management system (CMS) built on the Laravel framework. It is known for its simplicity, flexibility, and extensibility, making it ideal for various web projects. In this guide, we will walk you through how to install PyroCMS with Nginx and secure it using Let's Encrypt SSL on CentOS 8. Whether you are using a Windows VPS UK or another hosting platform, PyroCMS provides a great solution for content management.

Prerequisites

Before starting, ensure you have the following:

Step 1: Update Your System

Before installing any packages, update your system to ensure all packages are up to date:

sudo dnf update -y

Step 2: Install Nginx

Install Nginx, which will serve as the web server for PyroCMS:

sudo dnf install nginx -y

Start Nginx and enable it to start on boot:

sudo systemctl start nginx
sudo systemctl enable nginx

Step 3: Install PHP and Required Extensions

PyroCMS is built on Laravel, which requires PHP and certain extensions. Install PHP 7.4 and the necessary extensions:

sudo dnf install epel-release -y
sudo dnf install php php-fpm php-mysqlnd php-xml php-mbstring php-zip php-json php-curl php-gd -y

Once installed, start and enable PHP-FPM:

sudo systemctl start php-fpm
sudo systemctl enable php-fpm

Step 4: Install and Configure MySQL (MariaDB)

PyroCMS requires a database to store its content. Install MariaDB (MySQL equivalent) using the following commands:

sudo dnf install mariadb-server -y
sudo systemctl start mariadb
sudo systemctl enable mariadb

Secure the MariaDB installation:

sudo mysql_secure_installation

Log in to MariaDB and create a database and user for PyroCMS:

sudo mysql -u root -p
CREATE DATABASE pyrodb;
CREATE USER 'pyrouser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON pyrodb.* TO 'pyrouser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 5: Install Composer

Composer is a dependency manager for PHP that is required to install PyroCMS. Install Composer using the following command:

sudo dnf install composer -y

Step 6: Install PyroCMS

Navigate to the web root directory and use Composer to install PyroCMS:

cd /var/www
sudo composer create-project pyrocms/pyrocms --prefer-dist pyro

After the installation is complete, set the correct permissions:

sudo chown -R nginx:nginx /var/www/pyro
sudo chmod -R 755 /var/www/pyro

Step 7: Configure Nginx for PyroCMS

Create a new Nginx server block for PyroCMS:

sudo nano /etc/nginx/conf.d/pyro.conf

Add the following content, replacing your-domain.com with your actual domain:

server {
    listen 80;
    server_name your-domain.com www.your-domain.com;
    root /var/www/pyro/public;

    index index.php index.html index.htm;

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

    location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass unix:/run/php-fpm/www.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~ /\.ht {
        deny all;
    }
}

Save and close the file. Test the Nginx configuration:

sudo nginx -t

Then restart Nginx to apply the changes:

sudo systemctl restart nginx

Step 8: Install and Configure Let's Encrypt SSL

To secure your PyroCMS site with SSL, install Certbot (Let's Encrypt client) and obtain a free SSL certificate:

sudo dnf install certbot python3-certbot-nginx -y
sudo certbot --nginx -d your-domain.com -d www.your-domain.com

Follow the prompts to install the certificate. Certbot will automatically configure Nginx to redirect HTTP traffic to HTTPS.

Step 9: Complete PyroCMS Installation

Open your web browser and navigate to https://your-domain.com to complete the PyroCMS installation via the web interface. Enter your database details and configure the site settings as required.

Conclusion

By following these steps, you have successfully installed PyroCMS with Nginx and secured it with Let's Encrypt SSL on CentOS 8. Whether you're hosting your site on a Windows VPS UK, Windows VPS Italy, or another Windows Virtual Private Server Hosting solution, PyroCMS offers a flexible and scalable content management system for your web projects.

Cette réponse était-elle pertinente? 0 Utilisateurs l'ont trouvée utile (0 Votes)