# install
apt install php7.3-fpm
apt install nginx
# you need the mysql libraries to connect to mysqli(host, user, pass, instance)
apt install php7.3-mysql
# edit nginx to use php
nano /etc/nginx/sites-enabled/default
# Replace this:
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# With:
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
}
# create a hello file
nano /var/www/html/hello.php
# With contents:
<?php
echo "hi";
?>
# restart nginx
/etc/init.d/nginx restart
# test
http://my-ip-here/hello.php
Debugging:
If you have issues connecting to your mysql database, make sure you create a php page with
<?php phpinfo(); ?>
and ensure you have mysqli installed:
