1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
| | ;; -*- mode: scheme -*-
;;
;; This is an operating system configuration template for a basic php-fpm
;; server. It will serve a single page on http://localhost/
(use-modules (gnu))
(use-service-modules networking php web)
(use-package-modules admin)
(use-package-modules php) ; for php-hello-world, an example php application
(define NGINX
;; FIXME: should be (string-append nginx "/"))
"/gnu/store/np656cjgc87rv18klcr2vwxk6g0kjhbz-nginx-1.11.6")
(define PHP-HELLO-WORLD
;; FIXME: should be (string-append php-hello-world "/"))
"/gnu/store/9wqzxfs2xgr4ic1iwq124dq7cfqg1yi9-php-hello-world-0.1")
;; TODO: Use nginx configuration mechanisms when they are finished
(define (CONFIG nginx php-hello-world)
(string-append "
user nginx www;
pid /var/run/nginx/pid;
error_log /var/log/nginx/error.log info;
http {
client_body_temp_path /var/run/nginx/client_body_temp;
proxy_temp_path /var/run/nginx/proxy_temp;
fastcgi_temp_path /var/run/nginx/fastcgi_temp;
uwsgi_temp_path /var/run/nginx/uwsgi_temp;
scgi_temp_path /var/run/nginx/scgi_temp;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log info;
server_tokens off;
include " nginx "/share/nginx/conf/fastcgi.conf;
server {
listen 80;
server_name _;
root " php-hello-world "/;
index index.php;
# Per server logging
access_log /var/log/nginx/www.access.log;
error_log /var/log/nginx/www.error.log notice;
location / {
try_files $uri $uri/ /index.php;
}
# serve static files directly
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
access_log off;
expires max;
}
location ~ \\.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm-www.sock;
fastcgi_index index.php;
}
}
}
"))
(define CONFIG (CONFIG NGINX PHP-HELLO-WORLD))
(operating-system
(host-name "phempton")
(timezone "Europe/Berlin")
(locale "en_US.UTF-8")
(kernel-arguments '("vga=791")) ; 1024x768 pixel
;; Assuming /dev/sdX is the target hard disk, and "my-root" is
;; the label of the target root file system.
(bootloader (grub-configuration (device "/dev/sdX")))
(file-systems (cons (file-system
(device "my-root")
(title 'label)
(mount-point "/")
(type "ext4"))
%base-file-systems))
;; Globally-installed packages.
(packages (cons*
php-hello-world ; an example php application
%base-packages))
;; We need to add a user and a group for each pool (defaults are the pool
;; name). TODO: This should be done automatically, based on the pool
;; configuration given below.
(groups (cons
(user-group (name "www"))
%base-groups))
(users (cons
(user-account
(name "www")
(group "www")
(home-directory "/var/empty")
(shell (file-append shadow "/sbin/nologin")))
%base-user-accounts))
(services (cons*
(dhcp-client-service)
(console-keymap-service "de")
(nginx-service
#:config-file (plain-file "nginx.conf" CONFIG))
(php-fpm-service
#:config
(php-fpm-configuration
(pools (list
(php-fpm-pool
(name "www"))))))
%base-services)))
|