Skip to content

Commit

Permalink
Merge pull request #6359 from linode/Rajakavitha1-patch-81
Browse files Browse the repository at this point in the history
[update] Serve PHP with PHP-FPM and NGINX
  • Loading branch information
Rajakavitha1 authored Sep 19, 2023
2 parents c362786 + 14723cd commit 10a7945
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,15 @@ server {
This only applicable if you allow users to upload or submit files to your site. Change the name of the directory from `uploads` to whatever suits your need.

{{< file "/etc/nginx/conf.d/example.com.conf" nginx >}}
location ~* \.php$ {
if ($uri !~ "^/uploads/") {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
location ~ ^ /uploads/ {
try_files $uri =404;
}
location ~* \.php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
{{< /file >}}

3. Reload NGINX:
Expand Down

0 comments on commit 10a7945

Please sign in to comment.