I have error production when bench setup production and bench restart

I have this error when I do bench setup production
how can fixed

Setting Up prerequisites…
Setting Up supervisor…
supervisor.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Setting Up NGINX…
nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Port configuration list:

Site ettc.axis-ksa.org assigned port: 8007
Setting Up symlinks and reloading services…
$ /usr/bin/supervisorctl reread
error: <class ‘ConnectionRefusedError’>, [Errno 111] Connection refused: file: /usr/lib/python3/dist-packages/supervisor/xmlrpc.py line: 560
$ /usr/bin/supervisorctl reload
error: <class ‘ConnectionRefusedError’>, [Errno 111] Connection refused: file: /usr/lib/python3/dist-packages/supervisor/xmlrpc.py line: 560
$ sudo systemctl restart supervisord
Failed to restart supervisord.service: Unit supervisord.service not found.
$ sudo systemctl restart supervisor
$ sudo /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ sudo systemctl reload nginx
nginx.service is not active, cannot reload.
ERROR:
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 8, in
sys.exit(cli())
File “/usr/local/lib/python3.8/dist-packages/bench/cli.py”, line 127, in cli
bench_command()
File “/usr/lib/python3/dist-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/lib/python3/dist-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/lib/python3/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python3/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python3/dist-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python3/dist-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/usr/local/lib/python3.8/dist-packages/bench/commands/setup.py”, line 108, in setup_production
setup_production(user=user, yes=yes)
File “/usr/local/lib/python3.8/dist-packages/bench/config/production_setup.py”, line 87, in setup_production
reload_nginx()
File “/usr/local/lib/python3.8/dist-packages/bench/config/production_setup.py”, line 206, in reload_nginx
service(“nginx”, “reload”)
File “/usr/local/lib/python3.8/dist-packages/bench/config/production_setup.py”, line 117, in service
exec_cmd(f"sudo systemctl {service_option} {service_name}")
File “/usr/local/lib/python3.8/dist-packages/bench/utils/init.py”, line 155, in exec_cmd
raise CommandFailedError
bench.exceptions.CommandFailedError

restart nginx

You need to change the supervisor ownership and restart the supervisord process.
In the file /etc/supervisor/supervisord.conf;
the default is chmod=0700
which needs to become

chmod=0760
chown=YourERPNextUserName:YourERPNextUserName

change “YourERPNextUserName” to match the name you used in the setup, and then
sudo systemctl restart supervisor nginx

3 Likes

Thanks a lot its works
but the site did not work with the production

when stop nginx and do bench start
its work
what is the problem?!

Did you specify a different port?

@trentmu
No, I didn’t

I think it was assigned to port 8007. You can either change the port using
bench set-nginx-port sitename 80

or you can try browsing to
http://ettc.axis-ksa.org:8007