Installing and Configuring Contao in the ServBay Environment
What is Contao?
Contao is an open-source content management system (CMS) designed for small to medium-sized websites. It offers rich features and flexible extendability, suitable for various types of websites. Contao's user interface is friendly, easy to use, and has powerful permission management and multi-language support.
Steps to Install Contao
In this article, we will introduce how to install and configure Contao in the ServBay environment.
Step 1: Create Project Directory
First, create a new project directory in the www
directory of ServBay:
cd /Applications/ServBay/www
mkdir servbay-contao-app
cd servbay-contao-app
2
3
Step 2: Use Composer to Create a Contao Project
ServBay comes with Composer, so we can directly use Composer to create a Contao project:
composer create-project contao/managed-edition .
Step 3: Create Database and User
Access ServBay's built-in phpMyAdmin database management tool
Open https://servbay.host/, click "phpMyAdmin" to enter the phpMyAdmin database management tool.
Create Database User
Go to the User Accounts Page
- On the main page of phpMyAdmin, click "User Accounts" in the top menu.
Add New User
- Click "Add User Account".
- Fill in the following information:
- Username:
contao_user
- Hostname:
localhost
- Password: Enter a secure password, for example,
password123
- Re-enter: Enter the password again
- Username:
- In the "Database for User" section, select "Create database with the same name and grant all privileges".
- Make sure to check "Grant All Privileges".
- Click "Go" button.
Step 4: Configure Web Server
Add New Website
Open ServBay, click the "Hosts" tab, and add a new website:
- Name:
My Contao Site
- Domain:
servbay-contao.local
- Website Type:
PHP
- PHP Version: Select the corresponding PHP version
- Website Root Directory:
/Applications/ServBay/www/servbay-contao-app/web
- Name:
Save Configuration
Save the configuration.
Step 5: Run Contao Installer
Access the Installation Page
Open your browser, go to
https://servbay-contao.local/contao/install
, and you will see the Contao installation page.Fill in Database Information
Fill in the database connection information as prompted:
- Database Host:
localhost
- Database Name:
contao_user
(same as the username) - Username:
contao_user
- Password:
password123
- Database Host:
Fill in Administrator Information
Fill in the administrator username and password as prompted.
Complete the Installation
Click the "Install" button to complete the installation process.
Step 6: Install Extensions and Themes
Install Extensions
Log in to the Contao admin backend, click "Extension Manager", search and install the extensions you need.
Install Themes
Click "Theme Manager", select and install a theme you like.
Using Contao to Build Websites
Now that you have successfully installed and configured Contao in the ServBay environment, you can start using it to build your website. Here are some common operations:
Create Pages and Articles
Create Pages
In the Contao admin backend, click "Site Structure" -> "New Page", fill in the page title and content, and then click "Save".
Create Articles
Click "Articles" -> "New Article", fill in the article title and content, and then click "Save".
Configure Navigation Menu
Create Menu
In the Contao admin backend, click "Modules" -> "New Module", select "Navigation Menu", fill in the module name and other settings, then click "Save".
Add Menu Items
Add pages to the navigation menu, and then click "Save".
Customize Widgets
Add Widgets
In the Contao admin backend, click "Modules" -> "New Module", select the type of widget you need, fill in the module name and other settings, then click "Save".
Configure Widgets
Configure the widget settings as needed, then click "Save".
Through the above steps, you successfully installed and configured Contao in the ServBay environment and started using it to build your website. Contao’s powerful features and flexibility make it an ideal choice for building all kinds of websites.