Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku Local: "http" directive is duplicate

Tags:

nginx

heroku

I'm running into the following issue when running heroku local:

[emerg] 595#0: "http" directive is duplicate in /usr/local/etc/nginx/nginx.conf:17

I've got heroku/heroku-buildpack-php": "*" in my composer.json, and a fresh install of nginx (using brew install nginx)

Could someone explain to me what could be happening?

like image 991
Sylvain Avatar asked Jan 06 '23 01:01

Sylvain


1 Answers

So it seems the problem is related to the heroku.conf generated by $root/vendor/heroku/heroku-buildpack-php/conf/nginx/heroku.conf.php

Heroku local runs nginx with nginx: master process nginx -g daemon off; include $root/vendor/heroku/heroku-buildpack-php/conf/nginx/heroku.conf;

So both /usr/local/etc/nginx/nginx.conf and heroku.conf are loaded, hence the duplicate directive.

I've modified /usr/local/etc/nginx/nginx.conf to only include

worker_processes  1;
events {
  worker_connections  1024;
}

since without the events section nginx won't start, and left the rest to heroku.conf.

like image 102
Sylvain Avatar answered Jan 23 '23 01:01

Sylvain