multi-tenant: The command "/etc/init.d/nginx configtest" failed when creating new website

Description

The php script to create a new tenant website reports the following error:

The command “/etc/init.d/nginx configtest” failed.

Exit Code: 1(General error)

Working directory: /home/vagrant/Code/cff/public

Output:

================

  • Testing nginx configuration …fail!

Error Output:

================

Actual behavior The tenant database has been created, including the tenant folder and the tenant nginx .config file. However the nginx .config file is not complete:

Here are the contents of the file:

Auto generated Apache configuration @author: hyn/multi-tenant @see: http://laravel-tenancy.com @time: 14:29:11 12-12-2017 @website id: 47 @website uuid: fb1396bbdadf445fbce6ee215f382908

   No hostnames found

that’ all there is in this file…

The remaining part of the website creation is abandoned, the hostname has not been created and the hostname is not attached to the website.

As a result, the new tenant web site cannot be accessed.

Expected behavior


Information

A few days ago, the code ran without any problem. After that I have upgraded to Hyn/multi-tenancy 5.0.15.

It might have something to do with access rights.

If I run “/etc/init.d/nginx configtest” manually from the command prompt, it returns an error. But if I run “sudo /etc/init.d/nginx configtest”, it reports no errors in the nginx config files.

Trying to find a solution, I added “sudo” in the webserver.php file in the nginx section like this: original code "‘test-config’ => ‘/etc/init.d/nginx configtest’, changed code ‘test-config’ => ‘sudo /etc/init.d/nginx configtest’,

Then, this error did not occur, but the next error appeared instead:

“The command “systemctl restart nginx” failed.”

Adding “sudo” to this line in the webserver.php file did not work.

  • hyn/multi-tenant version: 5.0.15
  • laravel version: 5.5
  • database driver and version: MariaDB 10.2
  • webserver software and version: nginx version: nginx/1.13.3
  • php version: 7.1
  • vagrant 2.01 with laravel/homestead (virtualbox, 5.0.1)

I have removed the laravel/homestead box completely and reinstalled a new one. That did not help either.

tenancy.php config

As attached

webserver.php config

As attached

Error log

As attached

TenantController.php: see attachment

[error.zip](https://github.com/hyn/multi-tenant/files/1552086/error.zip)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

@mah3uz you can create a queue with elevated permissions by adding a new queue with a specific name inside your queue.php then configuring supervisor to run only that user as root. The laravel documentation should help you here, if not please create a new issue or join us on discord.