nginx PID error on Vagrant up

29 views
Skip to first unread message

Jake Wilson

unread,
Jun 29, 2015, 6:42:48 PM6/29/15
to vagra...@googlegroups.com
I packaged a custom CentOS 7 base box with nginx running on it. I packaged it as a local package.box file. To use the box, I created a new Vagrantfile, and for the provision, I use the shell commands to make some changes to the /etc/nginx/nginx.conf file (like including some vhost configs in my sync'ed directory). The last thing in my provisions is to restart nginx: nginx -s reload. However when my vagrant up gets to this part, I get the following error:

nginx: /run/nginx.pid failed (2 no such file or directory)

So I think what that means is that it's trying to reload nginx, but since the PID file doesn't exist that means that nginx wasn't running to begin with.

So what is going on here? When I package up the box, nginx is running, and is set to run on startup. But when I use the box in a new environment, it thinks that nginx isn't running and therefore throws the error when trying to reload it. What am I missing here exactly?

Alvaro Miranda Aguilera

unread,
Jun 30, 2015, 4:42:29 AM6/30/15
to vagra...@googlegroups.com
Hello,

if you are installing nginx from epel as you are using a rpm based
distro, you should use the service <service> command

before packing the box, you can do

chkconfig nginx on
service nginx status && service nginx stop
rm -fr /run/nginx.pid

And on the new box, you can do something like

service nginx status && service nginx reload || service nginx start

Alvaro
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in violation
> of those guidelines may result in your removal from this mailing list.
>
> GitHub Issues: https://github.com/mitchellh/vagrant/issues
> IRC: #vagrant on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Vagrant" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vagrant-up+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vagrant-up/669d59a4-6f26-4585-bd93-23799b6f7753%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages