Skip to content

Commit

Permalink
works now
Browse files Browse the repository at this point in the history
Testing Code:

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>This is a Heading</h1>
<p>This is a paragraph.</p>

<?php
echo "My first PHP script!";
?>

</body>
</html>

Signed-off-by: John Titor <[email protected]>
  • Loading branch information
JohnRTitor committed Oct 1, 2024
1 parent 3b6756a commit 50b213d
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions dev-environment/nginx.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,30 @@
...
}: {
services.nginx.enable = true;

# Nginx virtual host configuration for localhost
services.nginx.virtualHosts."localhost" = {
locations."/phptest" = {
root = "/var/www/phptest";
root = "/var/www/phptest";
extraConfig = ''
index index.php;
'';

locations."~ ^(.+\\.php)(.*)$" = {
extraConfig = ''
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# Check that the PHP script exists before passing it
try_files $fastcgi_script_name =404;
include ${config.services.nginx.package}/conf/fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass unix:${config.services.phpfpm.pools.mypool.socket};
include ${pkgs.nginx}/conf/fastcgi.conf;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include ${pkgs.nginx}/conf/fastcgi.conf;
'';
};
};

# MySQL service
services.mysql = {
enable = true;
package = pkgs.mariadb;
Expand All @@ -28,6 +41,7 @@
settings = {
"pm" = "dynamic";
"listen.owner" = config.services.nginx.user;
"listen.group" = config.services.nginx.group;
"pm.max_children" = 5;
"pm.start_servers" = 2;
"pm.min_spare_servers" = 1;
Expand Down

0 comments on commit 50b213d

Please sign in to comment.