0

I am using Kirby on Ubuntu 16.04, and every time I reboot I have to login on my server, go to my website folder and type

sudo php -S 0.0.0.0:80

for the server to start.

What's a correct way of getting this to start automatically after a reboot?

Sorry for the trivial question, I just don't seem to be able to find a simple answer on the web...

edeboursetty
  • 5,669
  • 2
  • 40
  • 67
  • Just to make sure: you're only using `php -S` for testing, I would hope. It's not safe or practical for production sites. – Andrea Nov 09 '16 at 18:55
  • @Andrea right now I'm in testing, but I was planning to release it that way. That's all I got from Kirby CMS docs... What is the appropriate way? – edeboursetty Nov 10 '16 at 08:49
  • Configure a proper web server such as nginx or Apache. PHP's development web server is not secure or reliable in production. – Andrea Nov 10 '16 at 15:20

1 Answers1

1

You can use root's crontab with @reboot directive. Edit it with sudo crontab -e

@reboot cd /path/to/directory && php -S 0.0.0.0:80

Notice that there is no sudo before the php command, because it's run from root's crontab.

Ko Cour
  • 929
  • 2
  • 18
  • 29