Configure Nginx to serve PHP files on Ubuntu
11 March 2022 (Updated 11 March 2022)
Assuming you’ve setup Nginx and PHP-FPM, you’ll want to configure Nginx to use PHP-FPM to process PHP files.
Create sample PHP app
Create root web directory.
Create an info.php
file.
Paste the following code:
Assign ownership to a non-root user who will be responsible for most sysadmin tasks.
Create Nginx configuration
Add the following:
Activate this config by creating a symlink from the sites-enabled
directory:
Test configuration for syntax errors:
Activate new configuration:
Verify configuration
Assuming you’ve setup your DNS records properly, navigate to http://server_domain_or_IP/info.php
and you should see information about your PHP installation.
Tagged:
Nginx
Thanks for your comment . Once it's approved, it will appear here.
Leave a comment