Introduction
Drupal is a flexible and powerful content management system (CMS) that enables users to create and manage various types of websites. In this guide, you will learn how to install Drupal on Rocky Linux 8 using Nginx as the web server. This setup can be effectively hosted on a Windows VPS UK for optimal performance and reliability.
Prerequisites
- A Rocky Linux 8 server with root access
- Basic knowledge of Linux commands
- An active internet connection
- A registered domain name pointed to your server's IP address (optional but recommended)
Step 1: Update Your System
Start by updating your package index and upgrading existing packages:
sudo dnf update -y
Step 2: Install Required Packages
Install Nginx, PHP, and required PHP extensions:
sudo dnf install nginx php php-fpm php-mysqlnd php-xml php-gd php-mbstring php-zip -y
Step 3: Start and Enable Nginx
Start the Nginx service and enable it to run at boot:
sudo systemctl start nginx
sudo systemctl enable nginx
Step 4: Configure PHP-FPM
Edit the PHP-FPM configuration file:
sudo nano /etc/php-fpm.d/www.conf
Find the line that starts with user
and group
and change them to:
user = nginx
group = nginx
Save and exit the file, then start and enable PHP-FPM:
sudo systemctl start php-fpm
sudo systemctl enable php-fpm
Step 5: Download Drupal
Change to the web root directory and download the latest version of Drupal:
cd /var/www/html
sudo curl -s https://www.drupal.org/download-latest/tar.gz | sudo tar -xz --strip-components=1
Step 6: Set Permissions
Set the correct permissions for the Drupal directory:
sudo chown -R nginx:nginx /var/www/html/*
sudo chmod -R 755 /var/www/html
Step 7: Configure Nginx for Drupal
Create a new Nginx configuration file for Drupal:
sudo nano /etc/nginx/conf.d/drupal.conf
Add the following configuration:
server {
listen 80;
server_name yourdomain.com;
root /var/www/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php-fpm/www.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Replace yourdomain.com
with your actual domain name.
Step 8: Test Nginx Configuration
Test the Nginx configuration for syntax errors:
sudo nginx -t
Step 9: Restart Nginx
Restart the Nginx service to apply the changes:
sudo systemctl restart nginx
Step 10: Complete Drupal Installation
Open your web browser and navigate to http://yourdomain.com
. You should see the Drupal installation wizard. Follow the on-screen instructions to complete the installation.
Step 11: Conclusion
You have successfully installed Drupal CMS on Rocky Linux 8 with Nginx. This powerful content management system can greatly benefit from being hosted on a Windows VPS. For additional options, explore various VPS UK Windows solutions, including Windows Virtual Private Server Hosting and Windows VPS Hosting UK for optimal performance and security.