# Installation Guide

Concord CRM comes with an built-in user-friendly web installer. Makes the installation simple without the need for code modifications or file changes, making it accessible even for those with minimal technical expertise.

## Key Installation Aspects

- Built on Laravel: Concord CRM is developed using Laravel.
- Subdomain Installation: The most effective way to install Concord CRM is on a subdomain. This approach aligns with Laravel's requirement to direct the application's root to the `/public` path. Therefore, when setting up your subdomain, ensure it points directly to the `/public` folder.

Before proceeding with the installation, it's important to review the system requirements. This ensures your server environment is compatible with Concord CRM.

## Installation Video Tutorials

To assist you in the installation process, we provide comprehensive video tutorials for both cPanel and Plesk platforms. These tutorials are designed to guide you step-by-step, showcasing how effortlessly you can set up Concord CRM on your server.

We provide a hosted service for Concord CRM licenses. Purchase a license, and we'll host it on our servers.

If manual installation or configuration seems daunting, or if your current hosting doesn't meet Concord CRM's requirements, our hosting is an excellent choice. This hassle-free option includes automatic installation and advanced features tailored for Concord CRM, right out of the box.

Learn more

## Create Subdomain

Important: Ensure that the document root path of your subdomain is set to the `/public` directory. This step is crucial for the correct functioning of the application.

To set up your Concord CRM installation, a dedicated subdomain is required. Here's how to create it, using `crm.example.com` domain and cPanel as an example:

1. Access cPanel:
   - Log in to your cPanel dashboard by navigating to your hosting provider's login page.
2. Locate Subdomains:
   - In the cPanel interface, find and click on the `Subdomains` section.
3. Create Your Subdomain:
   - In the Subdomain input, enter `crm` in the subdomain field.
   - Crucial Step: For the Document Root, ensure you input the path to the `public` directory. This step is essential for the application to function properly.
   - Click on the `Create` button to finalize the creation of your subdomain.

## Upload Files

Important: Concord CRM requires a correctly set up subdomain, as explained in the previous step. Installation in a subfolder without a proper virtual host configuration will not work. If you're installing in a subfolder, consult your hosting provider to create a virtual host with the root path set to `path/to/subfolder/public`.

To initiate the Concord CRM web installer, you first need to obtain the application files:

1. Download Release Archive:
   - Access your Envato account's downloads page or visit the Concord CRM releases page to get the latest release.
2. Prepare for Upload:
   - Assume you have a subdomain named "crm" with the path `public_html/crm/`.
   - Ensure you have the correct path where the files need to be uploaded.
3. Upload Files to Server:
   - Using your preferred FTP client or the cPanel File Manager, upload the Concord CRM files to the `public_html/crm` directory on your server.

## Create Database

For detailed guidance, refer to the installation videos above.

You should create a dedicated database for your Concord CRM installation. Here's how to create it, using cPanel as an example:

1. Access cPanel:
   - Navigate to `www.example.com/cpanel` and log in.
2. Navigate to Databases:
   - In the cPanel dashboard, locate the `Databases` section and click on MySQL Databases. Note:
   - The location of this option might differ depending on your hosting provider.
3. Create a New Database:
   - Click on Create Database. Once created, it will be listed in the `Current Databases` section.
4. Create a Database User:
   - Establish a new user and assign a secure password. Remember to record the username and password, as you'll need them during the installation process.
5. Assign User to Database:
   - Link the new user to your database by selecting both the database and the username. Ensure you grant All Privileges to this user.

## Perform Install

Once you have successfully created the subdomain, set up the database, and uploaded the files, you're ready to begin the installation process. Follow these steps to install Concord CRM:

1. Access Installation URL:
   - Open your web browser and navigate to `https://crm.example.com/install`. Remember to replace `crm.example.com` with your actual domain name.
2. Check Server Requirements:
   - The installer will automatically check if your server meets all requirements.
   - If you don't see a message regarding the failure of the requirements check, click Next to proceed.
   - If there are any issues, you'll need to consult with your hosting provider to resolve them before continuing.
3. Verify Permissions:
   - The installer will also check for the correct file and folder permissions.
   - If permissions are correctly set, click Next to enter application data.
   - If there are permission issues, you'll need to set 755 permissions for the specified folders. If you are managing the server, refer to the Permissions, User and Group section for detailed instructions.

### General Config

1. App Url:

   - Concord CRM will automatically try to guess the URL where the application will be installed, in our case now from, this example, the URL is https://crm.example.com, if the URL is wrong, please adjust it accordingly.

2. Application Name:

   - You can leave it as default or you can write your own name, for example, "My Company CRM"

3. Country:

   - Select your country.

4. Currency:

   - If not auto selected, select the default currency that will be used in Concord CRM.

### Configure Database

Add the database config in the installer

1. Hostname

   - Enter database hostname, in most cases, the default hostname is localhost, however, if it's different in your case, make sure to set the correct hostname.

2. Port

   - In most cases, this value will be `3306` as this port is MySQL default port, if you are not familiar with this option for your server, leave it as it is and continue to the next field, where you will need to configure the database name and user you created in the previous step.

3. Database Name

   - Enter the database name.

4. Database User

   - Enter the database username.

5. Database Password

   - Enter the database user password, for local installations and database users without password, leave it empty.

6. Test Connection & Configure:

   - Click "Test Connection & Configure" and if the database connection is successful you will be passed to the latest step otherwise please re-check your credentials and hostname.

7. On the next page, configure administrator user and perform the installation.

### Installation Finished Page

After you finish all the installation steps you will be presented with a installation successful screen where there will be information on how to configure cron job as well the guessed command and the path for the cron job.

Don't forget to copy the command/path so you can configure a cron job as explained here.

The installation success page will be available for 1 hour after installation, after 1 hour, when you visit the same URL, a 404 error will be shown.

## Nginx Config

If you are managing the server and you are already familiar with Laravel, probably you will know that for Nginx you will need to create separate configuration file so Concord CRM can be served.

The examples below are for installation on the root domain, but feel free to adjust the paths for the subdomain if you want to perform an installation on a subdomain.

    server {
        listen 80;
        server_name example.com;
        root /example.com/public;

        add_header X-Frame-Options "SAMEORIGIN";
        add_header X-XSS-Protection "1; mode=block";
        add_header X-Content-Type-Options "nosniff";

        index index.html index.htm index.php;

        charset utf-8;

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

        location = /favicon.ico { access_log off; log_not_found off; }
        location = /robots.txt  { access_log off; log_not_found off; }

        error_page 404 /index.php;

        location ~ \.php$ {
            fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
            include fastcgi_params;
        }

        location ~ /\.(?!well-known).* {
            deny all;
        }
    }

## Permissions, User And Group

If you are managing the server, you will need to make sure that the proper permissions are applied to all files and folders and also the files and folders belong to the user and group responsible for managing the web server, in most cases is `www-data`.

Keep in mind that you won't need to apply the commands below if your server is managed by your server provider, for example, shared hosting as the permissions and the group will be already configured for you.

Change all the directories to 755 (drwxr-xr-x):

    find /var/www/example.com -type d -exec chmod 755 {} \;

Change all the files to 644 (-rw-r--r--):

    find /var/www/example.com -type f -exec chmod 644 {} \;

Change the files and folders user and group

    sudo chown www-data:www-data -R /var/www/example.com

Don't forget to adjust the values in the example codes according to your setup.

## Next Steps

### Update/Patch Installation

After the installation succeeded, to ensure everything is up to date with latest features and fixes, it's highly recommended to check if there are any patches or updates available, you can do this in Settings -> System -> Update

### Configure Cron Job

Concord CRM requires a properly configured cron job in order all the features to work as expected, learn more how to configure Laravel cron job.

### Configure System Email Account

You should configure a system email account to act as a general email account that the system will use to send system-related emails like password reset, user assigned to contact, activity due reminders, etc...

Refer to the system email account configuration page for more information.

### Configure Brand

Concord CRM installation creates a default brand that will be used for the documents feature, make sure that the brand information and settings are accordingly set as per the brand requirements.

Read more about brands here

## SiteGround Installation

At this time SiteGround does not allow changing the subdomain document root via SiteTools, hence, you will need to apply few adjustments via a `.htaccess` file in the subdomain root folder.

1. Access your SiteGround hosting account and go to the Site Tools dashboard.
2. Navigate to Site -> File Manager.
3. Find the subdomain you created for the installation, e.q. crm.example.com
4. Navigate to `crm.example.com > public_html`.
5. Create new `.htaccess` file or edit the file if already exists.
6. Set the file contents as shown below:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^(www\.)?crm\.example\.com$
    RewriteCond %{REQUEST_URI} !^/public/
    RewriteRule ^(.*)$ /public/$1 [L,QSA]

7. Make sure to change the name if your subdomain crm and the name of the main domain example.com in the code above.

#### Flush SiteGround Cache

If you previously tried to perform installation and for some reason it failed or your installation was not working as expected because the document root as incorrect, you will need to make sure to flush any SiteGround content cache after editing the `.htaccess` file.

1. Navigate to Speed -> Caching: Here, you'll find options to manage the cache.
2. Click Dynnamic Cache.
3. Find your subdomain and use the click clear cache icon to flush any cache.
4. Continue the installation steps as you would normally do.