Introduction
Craft CMS is a flexible content management system that provides developers with tools for building custom websites. This guide will walk you through the steps to install Craft CMS on a Windows VPS.
Prerequisites
Before starting the installation, make sure you have the following prerequisites:
- A Windows VPS with administrative access.
- PHP 7.4 or higher installed.
- MySQL 5.7 or higher or MariaDB installed.
- Composer installed on your system.
- Web server (Apache or Nginx) installed.
Step 1: Install Required Software
Ensure the following software is installed:
- PHP: Download and install PHP from the official PHP website: PHP for Windows.
- MySQL or MariaDB: Download and install MySQL from MySQL Installer or MariaDB from MariaDB Download.
- Apache or Nginx: Install Apache or Nginx for the web server. Instructions are available on their official websites.
- Composer: Download and install Composer from the official website: Composer.
Step 2: Configure the Web Server
Set up your web server to serve Craft CMS:
- Configure Apache or Nginx: If using Apache, enable mod_rewrite. For Nginx, configure the server block to point to the Craft CMS installation directory.
- Create a Virtual Host: Set up a virtual host for Craft CMS in Apache or a server block in Nginx, ensuring it’s accessible via your domain or IP address.
Step 3: Download Craft CMS
Now, download the latest version of Craft CMS:
- Using Composer: The easiest way to install Craft CMS is through Composer. Run the following command in your terminal to download Craft CMS:
composer create-project craftcms/craft /path/to/your/project
- Manual Download: Alternatively, you can download the Craft CMS package from the official website: Craft CMS Download, and unzip it into the desired directory.
Step 4: Configure the Database
Next, set up the database for Craft CMS:
- Create a Database: Log into MySQL or MariaDB and create a new database for Craft CMS:
CREATE DATABASE craft;
- Create a Database User: Create a new user and grant the necessary privileges:
CREATE USER 'craft_user'@'localhost' IDENTIFIED BY 'your_password'; GRANT ALL PRIVILEGES ON craft.* TO 'craft_user'@'localhost';
- Flush Privileges: Apply the changes:
FLUSH PRIVILEGES;
Step 5: Set Permissions
Set the correct permissions for Craft CMS:
- Set Folder Permissions: Ensure the
storage
andconfig
folders are writable by the web server. For example:
chmod -R 775 /path/to/your/project/storage /path/to/your/project/config
Step 6: Run the Craft CMS Installer
Now, you can run the Craft CMS installer:
- Access the Installer: In your web browser, navigate to the Craft CMS site (e.g.,
http://yourdomain.com
) to start the installation process. - Follow the Wizard: The Craft CMS installer will guide you through the setup process. Provide the following details:
- Database configuration (use the database credentials created earlier).
- Admin user details for the Craft CMS backend.
- Site name and URL.
Step 7: Complete the Installation
After completing the installation wizard:
- Remove the Install File: For security reasons, delete the
install.php
file from the Craft CMS directory. - Access the Admin Panel: Log in to the Craft CMS admin panel using the credentials you created during installation.
Conclusion
Congratulations! You have successfully installed Craft CMS on your Windows VPS. You can now start building and managing your website with Craft CMS.