{"id":17886,"date":"2015-10-23T11:25:13","date_gmt":"2015-10-23T16:25:13","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=17886"},"modified":"2022-12-08T10:23:39","modified_gmt":"2022-12-08T16:23:39","slug":"how-to-install-espocrm-with-nginx-on-an-ubuntu-vps","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-install-espocrm-with-nginx-on-an-ubuntu-vps\/","title":{"rendered":"How to install EspoCRM with Nginx on an Ubuntu VPS"},"content":{"rendered":"
In this tutorial we are going to provide you with step-by-step instructions on how to install EspoCRM 3.7.2 with Nginx on an Ubuntu VPS<\/a><\/strong>. <\/p>\n Make sure your package list and the OS packages are up to date by running the following commands:<\/p>\n To install the latest Nginx version from the official Nginx repository, edit the ‘\/etc\/apt\/sources.list’ file:<\/p>\n Add the following lines:<\/p>\n Stop and remove Apache service:<\/p>\n Install Nginx on your virtual server<\/a>:<\/p>\n Configure Nginx to start on boot:<\/p>\n Install PHP and PHP modules required by EspoCRM:<\/p>\n Then, start with the EspoCRM installation procedure. Get the latest version of EspoCRM\u00a0 available at ‘http:\/\/www.espocrm.com\/downloads\/’ to a directory of your virtual server and extract it using the following commands:<\/p>\n Create a new Nginx configuration file and add the following virtual block for your domain name:<\/p>\n Add the following lines:<\/p>\n server { root \/var\/www\/espocrm; location \/api\/v1\/ { location \/ { location ^~ (data|api)\/ { location ^~ \/data\/logs\/ { location ~* \\.(?:ico|css|js|gif|jpe?g|png)$ { location ~ \\.php$ { Do not forget to replace your-domain.com with your actual domain name. Then, delete the ‘default’ Nginx configuration file:<\/p>\n Open the ‘\/etc\/php5\/fpm\/pool.d\/www.conf’ file and change the ‘listen’ variable:<\/p>\n change:<\/p>\n to<\/p>\n Locate the PHP configuration file:<\/p>\n Edit the \u2018\/etc\/php5\/apache2\/php.ini\u2019 configuration file:<\/p>\n Add\/modify the following settings:<\/p>\n The webserver user (www-data) needs to be able to write to files and directories inside the ‘\/var\/www\/espocrm’ directory, so it can easily be accomplished by executing the following command:<\/p>\n Test the nginx configuration:<\/p>\n If test is successful, restart php5-fpm and Nginx services for the changes to take effect:<\/p>\n EspoCRM requires a database to work as this is where data is saved, so create a new MySQL database on your server:<\/p>\n Open http:\/\/your-domain.com\/ using a web browser and follow the easy instructions. <\/p>\n Do not forget to add this line to the crontab file to run Espo Scheduled Jobs:<\/p>\n That is it. The EspoCRM installation is now complete. PS<\/span>.<\/strong> If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":" In this tutorial we are going to provide you with step-by-step instructions on how to install EspoCRM 3.7.2 with Nginx … <\/p>\n
\nEspoCRM is an open source Customer Relationship Management web application that allows you to see, enter and evaluate all your company relationships regardless of the type. It is designed to be fast, simple, and customizable.<\/p>\nsudo apt-get update\r\nsudo apt-get upgrade<\/pre>\n
sudo vi \/etc\/apt\/sources.list<\/pre>\n
deb http:\/\/nginx.org\/packages\/ubuntu\/ trusty nginx\r\ndeb-src http:\/\/nginx.org\/packages\/ubuntu\/ trusty nginx\r\n<\/pre>\n
sudo service apache2 stop\r\nsudo apt-get remove apache2<\/pre>\n
sudo apt-get update\r\nsudo apt-get install nginx<\/pre>\n
sudo update-rc.d -f nginx defaults<\/pre>\n
sudo apt-get install php5 php5-cli php5-fpm php5-mysql php5-gd php5-mcrypt php5-imap\r\nsudo php5enmod mcrypt\r\nphp5enmod imap<\/pre>\n
cd \/opt\/\r\nwget http:\/\/www.espocrm.com\/downloads\/EspoCRM-3.7.2.zip\r\nunzip EspoCRM-3.7.2.zip\r\nmv EspoCRM-3.7.2\/ \/var\/www\/espocrm\/<\/pre>\n
vi \/etc\/nginx\/conf.d\/your-domain.com.conf<\/pre>\n
\nlisten 80;
\nserver_name your-domain.com;<\/p>\n
\nindex index.php index.html;
\naccess_log \/var\/log\/nginx\/your-domain.com-access.log;
\nerror_log \/var\/log\/nginx\/your-domain.com-error.log;
\ncharset en_us.UTF-8;<\/p>\n
\nif (!-e $request_filename){
\nrewrite ^\/api\/v1\/(.*)$ \/api\/v1\/index.php last; break;
\n}
\n}<\/p>\n
\nrewrite reset\/?$ reset.html break;
\n}<\/p>\n
\nif (-e $request_filename){
\nreturn 403;
\n}
\n}<\/p>\n
\nreturn 403;
\n}
\nlocation ^~ \/data\/config.php {
\nreturn 403;
\n}
\nlocation ^~ \/data\/cache\/ {
\nreturn 403;
\n}
\nlocation ^~ \/data\/upload\/ {
\nreturn 403;
\n}
\nlocation ^~ \/application\/ {
\nreturn 403;
\n}
\nlocation ^~ \/custom\/ {
\nreturn 403;
\n}
\nlocation ^~ \/vendor\/ {
\nreturn 403;
\n}<\/p>\n
\nexpires max;
\nadd_header Pragma public;
\nadd_header Cache-Control “public, must-revalidate, proxy-revalidate”;
\n}<\/p>\n
\ntry_files $uri =404;
\nfastcgi_split_path_info ^(.+\\.php)(\/.+)$;
\nfastcgi_pass 127.0.0.1:9000;
\nfastcgi_index index.php;
\nfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
\ninclude fastcgi_params;
\n}
\n}<\/p>\nrm \/etc\/nginx\/conf.d\/default.conf<\/pre>\n
listen = \/var\/run\/php5-fpm.sock<\/pre>\n
listen = 127.0.0.1:9000;<\/pre>\n
# php -i | grep -i php.ini\r\nConfiguration File (php.ini) Path => \/etc\/php5\/cli\r\nLoaded Configuration File => \/etc\/php5\/cli\/php.ini<\/pre>\n
vi \/etc\/php5\/cli\/php.ini<\/pre>\n
max_execution_time = 300\r\nmax_input_time = 300\r\nmemory_limit = 256M\r\npost_max_size = 32M\r\nupload_max_filesize = 32M<\/pre>\n
sudo chown www-data:www-data -R \/var\/www\/espocrm\/<\/pre>\n
# nginx -t\r\nnginx: the configuration file \/etc\/nginx\/nginx.conf syntax is ok\r\nnginx: configuration file \/etc\/nginx\/nginx.conf test is successful<\/pre>\n
sudo service php5-fpm restart\r\nsudo service nginx restart<\/pre>\n
mysql -u root -p\r\nmysql> create database espocrmdb;\r\nmysql> GRANT ALL PRIVILEGES ON espocrmdb.* TO 'espocrmuser'@'localhost' IDENTIFIED BY 'Y0UR-PASSW0RD';\r\nmysql> flush privileges;\r\nmysql> quit<\/pre>\n
\nOnce installed, open http:\/\/your-domain.com and the first user you create will be the Admin user. Click the ‘Create Account’ button and go to the ‘Create Account’ page. Then, log in to the administrator back-end and configure EspoCRM according to your needs.<\/p>\n* * * * * \/usr\/bin\/php -f \/var\/www\/espocrm\/cron.php > \/dev\/null 2>&1<\/pre>\n
\nOf course you don\u2019t have to do any of this if you use one of our Linux VPS Hosting<\/a> services, in which case you can simply ask our expert Linux admins to install EspoCRM with Nginx<\/strong> for you. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n