Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Please check out How To Install Linux, Nginx, MySQL, PHP (LEMP stack) on Ubuntu 18.04.
Hi there,
Yes, this is also doable with Nginx as well as Apache.
You need to duplicate the .php location rule and add one for .htm$.
So the configuration will look like this, depending on yuor PHP configuration:
location ~ \.htm$ {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
Hope that this helps. Regards, Bobby
Update the Server Block Add a location block to handle .html files like .php files. Modify your server block to include the following:
server {
server_name yourdomain.com www.yourdomain.com;
root /var/www/html;
index index.php index.html;
# Existing PHP configuration
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # Adjust PHP version if needed
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# Parse .html files as PHP
location ~ \.html$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_log /var/log/nginx/yourdomain-error.log;
access_log /var/log/nginx/yourdomain-access.log;
}
/var/www/html with the root directory of your website.php7.4-fpm.sock to match the PHP version installed on your server (e.g., php8.0-fpm.sock).