运行php推荐
pm2 start .sh --interpreter bash
pm2 start "php index.php" "/index/receiver/receive" --name aaa
.sh内容 (tp5里的命令行)
php index.php /index/receiver/receive
前言
说起这个pm2,在node的世界里面,并不存在nginx或者apache,甚至tomcat这种东东。一个node,本身就用几行代码,就可以启动个server进程,监听个端口,为大家提供web服务。这和传统的网站代码的部署,是极为不一致的。
当然,我们还可以把一个node理解为一个php-fpm,我们在前面再嫁接一个nginx。那么就可以像大家平时所看到的一样,很多个域名,对应于不同的程序,而都使用80端口了。一般来说,一个node网站就会占用一个端口(并不是绝对的,以后苏南大叔给大家介绍特例)。我们利用nginx转发不同域名的80请求,到不同的node网站端口上即可。
pm2 start 众多方式
本文中,苏南大叔将重点介绍pm2 start这个命令。我们将使用它来启动不同的网站。因为node的世界里面,百花齐放的太厉害。启动一个网站的办法,也会有很多种。但是一般都可以用pm2 start来启动。只不过具体的参数会有所不同。
pm2 start .js
pm2 start .json
pm2 start .py --interpreter python
pm2 start .sh --interpreter bash
pm2 start .