Continuing the discussion from Provision fails on nginx reload in wordpress-setup task:
I’m not using vanilla bedrock-ansible, but wanted to start a related discussion for future reference as I’m experiencing the same issue with my modified setup.
I’ve got two app servers. I run nginx reload on both, one succeeds, the other fails with
reload: Job is not running: nginx
I’ll report back when I have more information.
Aha, here we go. This occurs when there’s no PID associated with the nginx process. The PID file exists in both locations, but as to why one generated a PID and not the other, I’m not sure.
/run/nginx.pid and starting the nginx process doesn’t resolve it…
Filtered output of
ps aux | grep nginx on problematic server:
root 3088 0.0 0.0 31488 788 ? Ss Jun23 0:00 nginx: master process nginx -g daemon off;
And the good server:
root 16237 0.0 0.1 90832 1580 ? Ss 18:44 0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
The good server has additional nginx worker processes as well. I had better luck attempting to use
/etc/init.d/nginx instead of
Aaaand aha! I do believe this is it: I based the infrastructure off this
terraform configuration. I left in the
cloud-init configuration, which spun up an nginx instance. Why this broke the first app server instead of the second is beyond me, but there’s the problem, at least in this instance.
Would be cool to see some Terraform configuration for a PHP/WP server in the future.