<pclass="intro">PHP is one of the highest used programming languages for websites, and it allows you to add practically any functionality you'd ever want to your sites.</p>
<pclass="intro">PHP is one of the highest used programming languages for websites, and it allows you to add practically any functionality you'd ever want to your sites.</p>
<p>This will use nginx's fastcgi-php.conf snippet which is more secure by deafult than many other php/nginx configs because it 404s if the files doesn't exist. Read Neal Poole's<ahref="https://nealpoole.com/blog/2011/04/setting-up-php-fastcgi-and-nginx-dont-trust-the-tutorials-check-your-configuration/"target="_blank"rel="noopener">Don't trust the tutorials</a> for more info.</p>
<p>This will use nginx's fastcgi-php.conf snippet which is more secure by default than many other php/nginx configs because it 404s if the requested file doesn't exist. Read Neal Poole's<q><ahref="https://nealpoole.com/blog/2011/04/setting-up-php-fastcgi-and-nginx-dont-trust-the-tutorials-check-your-configuration/"target="_blank"rel="noopener">Don't trust the tutorials</a></q> for more info.</p>
<p>Create a PHP file e.g. <strong>filename.php</strong> in the website's directory, and add the snippet below into it</p>
<p>Create a PHP file e.g. <strong>filename.php</strong> in the website's directory, and add the snippet below into it.</p>
<pre><code><?php phpinfo(); ?></code></pre>
<pre><code><?php phpinfo(); ?></code></pre>
<p>Go to that webpage in your browser e.g. <strong>domain.co.uk/filename.php</strong>, and if php is working you should see a dump of your PHP's version, headers, etc.</p>
<p>Go to that webpage in your browser e.g. <strong>domain.co.uk/filename.php</strong>, and if php is working you should see a dump of your PHP's version, headers, etc.</p>
<h2>Make nginx use index.php as homepage/root</h2>
<h2>Make nginx use index.php as homepage/root</h2>
<p>Now we'll set nginx to load up index.php as the root of the website, if it exists. Open the site's config with an editor</p>
<p>Now we'll set nginx to load up index.php as the root of the website, if it exists. Open the site's config with an editor.</p>
<p>Change the index line to read as below. This will then tell the server to load index.php, and if it doesn't exists, load index.html in it's stead</p>
<p>Change the index line to read as below. This will then tell the server to load index.php, and if it doesn't exists, load index.html in its stead.</p>
<p>Written by <ahref="https://aney.co.uk"target="_blank"rel="noopener">@aney</a> with <ahref="https://danluu.com/web-bloat/"target="_blank"rel="noopener">web bloat</a> in mind | <ahref="https://github.com/Aney/website"target="_blank"rel="noopener">Source Code</a></p>
<p>Written by <ahref="https://aney.co.uk"target="_blank"rel="noopener">@aney</a> with <ahref="https://danluu.com/web-bloat/"target="_blank"rel="noopener">web bloat</a> in mind | <ahref="https://github.com/Aney/website"target="_blank"rel="noopener">Source Code</a>.</p>