Setting up EspoCRM on Ubuntu 24.04 with Nginx provides a powerful, lightweight, and scalable solution for managing customer relationships. This guide walks you through installing and configuring EspoCRM, a popular open-source CRM platform, using Nginx as your web server. Before starting, ensure your server has a clean Ubuntu 24.04 installation, a static IP address, and root or sudo privileges. Having basic knowledge of Linux commands and server management will make the process smoother.
What You’ll Need
- Ubuntu 24.04 server with sudo access
- Root or sudo privileges
- Domain name pointed to your server’s IP (optional but recommended)
- Basic knowledge of Linux command line
Step-by-Step
- Update your system packages
sudo apt update && sudo apt upgrade -y - Install necessary dependencies
sudo apt install nginx mysql-server php-fpm php-mysql php-xml php-mbstring php-zip php-gd php-curl php-intl unzip git -y - Create a database for EspoCRM
sudo mysql -e "CREATE DATABASE espocrm CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" sudo mysql -e "CREATE USER 'espouser'@'localhost' IDENTIFIED BY 'your_password';" sudo mysql -e "GRANT ALL PRIVILEGES ON espocrm.* TO 'espouser'@'localhost';" sudo mysql -e "FLUSH PRIVILEGES;" - Download the latest EspoCRM package
wget https://github.com/espocrm/espocrm/releases/latest/download/espocrm.zip - Extract EspoCRM into the web directory
sudo unzip espocrm.zip -d /var/www/html/espocrm - Set proper permissions
sudo chown -R www-data:www-data /var/www/html/espocrm sudo chmod -R 755 /var/www/html/espocrm - Create an Nginx server block for EspoCRM
sudo nano /etc/nginx/sites-available/espocrmInsert the following configuration, replacing
with your actual domain or server IP: server { listen 80; server_name; root /var/www/html/espocrm; 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/php8.1-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht { deny all; } } - Enable the site and restart Nginx
sudo ln -s /etc/nginx/sites-available/espocrm /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl restart nginx sudo systemctl enable nginx - Configure PHP settings for EspoCRM
sudo nano /etc/php/8.1/fpm/php.iniAdjust or ensure the following settings are enabled:
- memory_limit = 256M
- upload_max_filesize = 50M
- post_max_size = 50M
- max_execution_time = 300
Then, restart PHP-FPM:
sudo systemctl restart php8.1-fpm - Complete the installation via web interface
– Open your browser and navigate to http://
– Follow the on-screen instructions to complete setup, including database connection and admin account creation.
Common Mistakes
- Not updating system packages before starting installation, leading to dependency issues.
- Forgetting to set correct permissions on the EspoCRM directory, which can cause web server access problems.
- Using an incorrect PHP socket path; verify your PHP version and socket location.
- Failing to restart PHP-FPM or Nginx after configuration changes, resulting in unresponsive services.
- Not configuring DNS properly, which can cause domain name resolution issues during setup.
Tips
- Use a strong password for the database user to enhance security.
- Set up a firewall (like UFW) to restrict access to only necessary ports (80, 443, 22).
- Consider enabling HTTPS with Let’s Encrypt for secure connections.
- Regularly backup your EspoCRM data and database.
- Keep your system and all components updated to patch security vulnerabilities.
Troubleshooting
If you encounter issues during installation or after setup:
- Site not loading or showing server errors: Check Nginx error logs at
/var/log/nginx/error.logand ensure your server block is correctly configured. - Database connection errors: Verify database credentials and ensure the MySQL server is running.
- PHP errors or blank pages: Check PHP error logs at
/var/log/php8.1-fpm.logand confirm PHP settings are correct. - Permissions issues: Ensure files are owned by www-data and permissions are set appropriately.
- SSL/TLS problems: Use Certbot to set up HTTPS and ensure your SSL certificates are correctly installed and configured.
Frequently Asked Questions
Can I install EspoCRM without a domain?
Yes, you can access it via your server’s IP address, but using a domain name is recommended for easier access and SSL setup.
Is Nginx suitable for hosting EspoCRM?
Absolutely. Nginx is lightweight, fast, and well-supported for PHP applications like EspoCRM.
What PHP version should I use?
EspoCRM is compatible with PHP 8.0 and above; ensure your server has PHP 8.1 installed for best compatibility.
How do I upgrade EspoCRM later?
Download the latest release, back up your database and files, then replace the application files and run upgrade scripts as needed.
Can I run EspoCRM behind HTTPS?
Yes, setting up SSL with Let’s Encrypt is straightforward and highly recommended for security.
What should I do if the web interface is blank?
Check PHP error logs, verify permissions, and ensure PHP-FPM is running properly. Browser console errors can also help diagnose issues.
By following this guide, you will have a fully functional EspoCRM instance running on Ubuntu 24.04 with Nginx, ready to help you manage your customer relationships efficiently. Proper configuration, security measures, and regular maintenance will ensure your CRM runs smoothly and securely for years to come.
Related
- How to Hide the Time and Date on Your Windows 11 Taskbar
- How to Hide the Reading Pane in Outlook.com Inbox
- How to Hide the Meet Section in Gmail on a Laptop or Desktop