I am trying to run php within html on an nginx server. What happens is that the php code within the html just gets printed, not executed. I can run php stanadalone scripts fine. but not ones within html. I have spent hours on this now.
Heres my sites-available/default file:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html index.php;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
I think I need to add a location html directive here, but I am unsure how to write it. I have tried several versions but they always give me errors. Anybody know how to proceed from here?