ERPNext Version 15 Install in Production Mode - Nginx Supervirsor Gunicorn

This is a continuation ( https://cloud.erpgulf.com/blog/support-forum/installing-erpnext-version-15-on-ubuntu-23+ ) and part of a series. The explanation can be found on Youtube.com/ERPGulf

 · 2 min read

Top 20 Manufacturing Production Interview Questions & Answers

----- NOW deploy it in production mode - on nginx server -------


Let us install nginx and supervisor at his stage


sudo apt install nginx supervisor


Change the ownership to erpgulf user for supervisor service. Otherwise it will fail to restart whenever you are doing an update.


sudo vim /etc/supervisor/supervisord.conf

Under [unix_http_server] section and also under [supervisord]

uncomment or add chown=erpgulf:erpgulf


Setup supervisor and nginx for Frappe.


su erpgulf ( if you are not already in that user , use whoami command to check )

cd /opt/bench/frappe-bench/

bench setup supervisor --yes

bench setup nginx






Copy setup file from bench folder to supervisor/nginx conf.d folder


sudo ln -s `pwd`/config/supervisor.conf /etc/supervisor/conf.d/frappe-bench.conf

 sudo ln -s `pwd`/config/nginx.conf /etc/nginx/conf.d/frappe-bench.conf





Remove the standard nginx sites. To avoid conflict and to avoid security vunlerabities

sudo rm /etc/nginx/sites-available/default

sudo rm /etc/nginx/sites-enabled/default



-----------------------------

Make changes on site_config.json ( inside site/site_name folder )


vim /opt/bench/frappe-bench/sites/xxxx-site_name/site_config.json


To make it non-development mode

 "developer_mode": 0,


sample below.

{

"db_name": "_7beb69e70202137e",

"db_password": "GiZeZxy4GPxfTzFA",

"db_type": "mariadb",

"developer_mode": 0,

"encryption_key": "iVahvGBPKPWWYQwqyxxxxxx7dMazzSX4SEClEtDzdQ=",

"host_name": "https://mysite.erpgulf.com:1203",

"user_type_doctype_limit": {

 "employee_self_service": 10

},

}


Restart supervisor and nginx servers


sudo systemctl enable supervisor

 sudo systemctl enable nginx ( You may encounter an error " unknown log format "main" , please see the Note-1 to know how to handle )



Make sure both supervisor and nginx working


service supervisor status

service nginx status

( Result will have a line with Active: active (running) since )

--------------------

Open the browser. Now you can see the portal on standard http port http://your-site-name.erpgulf.com/


--------------

Next step is Letsencrypt and SSL

--------------------------

It's explained here https://erpgulf.com/blog/support-forum/letsencrypt-on-ubuntu-version-20-for-erpnext



--------------------------

Note 1: *

If you face problem with nginx because of log type error ( log type main not found or something like that )


sudo vim /etc/nginx/nginx.conf and add following on http section.


log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"';

-----------------------


Cloud support

Cloud support team provides hosting related support and technology updates. Cover technology like cloud printing, Cloud PBAX, VoIP, Kubernetes, Ubuntu, Linux etc. Contact us on support@ERPGulf.com

3 comments
Simon February 9, 2024

Assets don't load after all these steps. It works but Assets dont load, you see only html in the browser. I tried bench build and it failed.

Suresh Parvathareddy July 15, 2023

After creating symbolic link, in the destination folder it is creating empty file, hence eventually telnet to localhost also is refusing. Got stuck at this steup, after creating when I open frappe-bench.conf from /etc/supervisor/conf.d/ it is empty. Please help me.............

Copy setup file from bench folder to supervisor/nginx conf.d folder sudo ln -s pwd/config/supervisor.conf /etc/supervisor/conf.d/frappe-bench.conf sudo ln -s pwd/config/nginx.conf /etc/nginx/conf.d/frappe-bench.conf

supun September 18, 2022

If I faced an error like " 502 Bad Gateway error | Nginx/1.18.0(ubuntu) " will it be solved when I add this V

sudo vim /etc/nginx/nginx.conf and add the following on HTTP section.

logformat main '$remoteaddr - $remoteuser [$timelocal] "$request" ' '$status $bodybytessent "$httpreferer" ' '"$httpuseragent" "$httpxforwardedfor"';


Add Comment