nohup php -S test.old.com:8000 &
需要在host文件中添加test.old.com
不然就是localhost 启动
设置自启动
需要在host文件下添加自己的域名
test.old.com 127.0.0.1
然后
cd /etc/systemd/system
添加service文件
内容
[Unit]
Description=Your Service Description
After=network.target
[Service]
Type=simple
ExecStart=/bin/bash -c "cd /home/dzy/dzy/work/lehuoyun2.0/public && php -S test.new.com:8001"
[Install]
WantedBy=multi-user.target
然后启动自启动程序```
sudo systemctl daemon-reload
sudo systemctl enable myscript.service
sudo systemctl start myscript.service