Move Develop to Production (Nginx not working)

Hello,

I installed develop version and now i want to move it to production, so don’t need to start bench.
for moving it to production i used below steps but Nginx not starting…

bench setup supervisor
sudo ln -s `pwd`/config/supervisor.conf /etc/supervisor/conf.d/frappe-bench.conf
sudo bench setup sudoers $(whoami)
bench setup nginx
sudo ln -s `pwd`/config/nginx.conf /etc/nginx/conf.d/frappe-bench.conf

Now when i do sudo service nginx status it shows

**●** nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: en
Active: **failed** (Result: exit-code) since Mon 2020-09-21 12:06:48 PKT; 5min ag
Docs: man:nginx(8)
Process: 11975 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process
Sep 21 12:06:48 MY-ERP systemd[1]: Starting A high performance web server an
Sep 21 12:06:48 MY-ERP nginx[11975]: nginx: [emerg] open() "/etc/nginx/sites
Sep 21 12:06:48 MY-ERP nginx[11975]: nginx: configuration file /etc/nginx/ng
Sep 21 12:06:48 MY-ERP systemd[1]: **nginx.service: Control process exited, co**
Sep 21 12:06:48 MY-ERP systemd[1]: **nginx.service: Failed with result 'exit-c**
Sep 21 12:06:48 MY-ERP systemd[1]: **Failed to start A high performance web se**
lines 1-12/12 (END)

and sudo service nginx start is showing

Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.

Hi @shahid, please try recommended step.

Setup in production mode

bench setup production [user]

  1. Create the production configuration files for supervisor and nginx:

bench setup supervisor
bench setup nginx

  1. Link the new configuration files to their respective services:

sudo ln -s pwd/config/supervisor.conf /etc/supervisord.d/frappe-bench.ini
sudo ln -s pwd/config/nginx.conf /etc/nginx/conf.d/frappe-bench.conf

  1. Enable services to start at boot:

sudo systemctl enable supervisord
sudo systemctl enable nginx

  1. Reboot:

sudo reboot

sudo bench setup prodcution $(whoami) should do all the that is necessary.
For more info execute

$bench --help

Hello thanks for your reply @Suresh_Thakor @mujeerhashmi
I am getting below error while running bench setup production frappe / $(whoami)

**frappe@MY-ERP** : **~/frappe-bench** $ sudo bench setup production frappe
**Traceback** (most recent call last):
2: from /usr/bin/bench:5:in `<main>'
1: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': **cannot load such file -- bundler (** **LoadError** **)**
1 Like

So many times I have followed @clarkej and @bkm suggestions. They shared very informative article here.

Hello,

I removed that ruby-active-model-serializers,
Now without sudo it ask for sudo, and with sudo it says bench not found.

**frappe@skyled-ERP** : **~/frappe-bench** $ bench setup production frappe
WARN: superuser privileges required for this command
**frappe@skyled-ERP** : **~/frappe-bench** $ bench setup production $(whoami)
WARN: superuser privileges required for this command
**frappe@skyled-ERP** : **~/frappe-bench** $ sudo bench setup production $(whoami)
sudo: bench: command not found

sudo bench setup production frappe ?

same, sudo: bench: command not found

Hi @shahid,

Please go through this thread may help.

ERPNext bench command not found - #16 by Pratik_Vaity

Also check this post

@trentmu, i reinstalled the ubuntu and installed erpnext again using easy script.

Hi all,

I have the same issue. Nginx is starting on 127.0.0.1 but thats it
When ever i go to the erp.example.com site . i get this following error.

Forbidden

You don’t have permission to access this resource.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Can anyone pls assist me?
Anand

Hi @Utesar72
did you resolve this? I’m also facing a same issue