Note: If you cannot find or edit nginx.conf, as is the case with ISPs, check whether your web hosting package includes a WordPress option. It is worth activating and testing this option.
The following examples assume that FlatPress is located in a subdirectory <FlatPress instance> of the root directory.

NGINX configuration (etc/nginx/nginx.conf) for Automatic, Path Info, HTTP Get and Pretty
========================================================================================

# Pretty (recommended)
location /<FlatPress instance>/ {
	root /var/www;
	try_files $uri $uri/ /<FlatPress instance>/index.php$is_args$args;
}

# Execute only real PHP files under the instance
location ~ ^/<FlatPress instance>/.*\.php$ {
	root /var/www;

	# important: only run genuine files
	try_files $uri = 404;

	include fastcgi_params;
	fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
	fastcgi_param QUERY_STRING $query_string;
	fastcgi_pass unix:/run/php/php8.4-fpm.sock; # adjust
}

# Optional sitemap aliases
location = /<FlatPress instance>/sitemap {
	rewrite ^ /<FlatPress instance>/sitemap.php last;
}
location = /<FlatPress instance>/sitemap.xml {
	rewrite ^ /<FlatPress instance>/sitemap.php last;
}

# Deny .ht* (and similar)
location ~ ^/<FlatPress instance>/\.ht {
	deny all;
}

# PATH_INFO (only if "Path Info" mode is used)
location ~ ^/<FlatPress instance>/index\.php(/|$) {
	root /var/www;

	include fastcgi_params;
	fastcgi_split_path_info ^(.+\.php)(/.*)$;

	# only execute real index.php
	try_files $fastcgi_script_name = 404;

	fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
	fastcgi_param PATH_INFO $fastcgi_path_info;
	fastcgi_param QUERY_STRING $query_string;
	fastcgi_pass unix:/run/php/php8.4-fpm.sock; # adjust
}


WordPress web hosting config for NGINX servers for Automatic, HTTP Get and Pretty
=================================================================================
location / {
	try_files $uri $uri/ /<FlatPress instance>/index.php?$args;
}


Apache configuration (.htaccess in FlatPress root directory)
============================================================

AddType application/x-httpd-php .php
Options -Indexes

<IfModule mod_headers.c>
	Header unset X-Powered-By
</IfModule>

<IfModule mod_rewrite.c>
	RewriteEngine On
	RewriteBase /<FlatPress instance>/

	RewriteRule ^\.htaccess$ - [F]

	RewriteRule ^\.setup\.php$ - [F,L]
	RewriteRule ^\.setup/ - [F,L]

	RewriteRule ^sitemap\.xml$ /<FlatPress instance>/sitemap.php [L]
	RewriteRule ^sitemap$ /<FlatPress instance>/sitemap.php [L]

	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d

	RewriteRule . /<FlatPress instance>/index.php [L]
</IfModule>
