openresty 和 nginx 切换问题
Problem switching between openresty and nginx
我正在尝试使用 exec
在 nginx
和 openresty
与 php
之间切换。
我用这个切换到openresty,exec('/bin/systemctl stop nginx ; /usr/local/openresty/nginx/sbin/nginx -p /usr/local/openresty/nginx');
和这个 exec('/usr/local/openresty/nginx/sbin/nginx -s stop ; /bin/systemctl start nginx');
切换到 nginx。
两者都在 ssh
中工作,但是,在 php 中我无法启动 nginx。这个/bin/systemctl start nginx
好像没有执行。我尝试从 .sh
文件中执行代码,但没有成功。
尝试使用
exec('/usr/local/openresty/nginx/sbin/nginx -s stop && /bin/systemctl start nginx');
我用这个切换到 openresty
:
shell_exec('/bin/systemctl stop nginx; /usr/local/openresty/nginx/sbin/nginx -p /usr/local/openresty/nginx');
然后切换到 nginx
:
shell_exec('/usr/local/openresty/nginx/sbin/nginx -s stop; /bin/systemctl restart nginx');
我正在尝试使用 exec
在 nginx
和 openresty
与 php
之间切换。
我用这个切换到openresty,exec('/bin/systemctl stop nginx ; /usr/local/openresty/nginx/sbin/nginx -p /usr/local/openresty/nginx');
和这个 exec('/usr/local/openresty/nginx/sbin/nginx -s stop ; /bin/systemctl start nginx');
切换到 nginx。
两者都在 ssh
中工作,但是,在 php 中我无法启动 nginx。这个/bin/systemctl start nginx
好像没有执行。我尝试从 .sh
文件中执行代码,但没有成功。
尝试使用
exec('/usr/local/openresty/nginx/sbin/nginx -s stop && /bin/systemctl start nginx');
我用这个切换到 openresty
:
shell_exec('/bin/systemctl stop nginx; /usr/local/openresty/nginx/sbin/nginx -p /usr/local/openresty/nginx');
然后切换到 nginx
:
shell_exec('/usr/local/openresty/nginx/sbin/nginx -s stop; /bin/systemctl restart nginx');