install/unix/nginx.xml
f0261e36dc250410f352fe33ad4c4e699cb18b02
...
...
@@ -33,7 +33,7 @@
33
33
<orderedlist>
34
34
<listitem>
35
35
<para>
36
-
It is recomended that you visit the Nginx Wiki
36
+
It is recommended that you visit the Nginx Wiki
37
37
<link xlink:href="&url.nginx.wiki.install;">install</link> page
38
38
in order to obtain and install Nginx on your system.
39
39
</para>
...
...
@@ -44,13 +44,13 @@
44
44
Obtain and unpack the PHP source:
45
45
</para>
46
46

47
-
<example xml:id="install.unix.nginx.extract.php">
47
+
<informalexample xml:id="install.unix.nginx.extract.php">
48
48
<screen>
49
49
<![CDATA[
50
50
tar zxf php-x.x.x
51
51
]]>
52
52
</screen>
53
-
</example>
53
+
</informalexample>
54
54
</listitem>
55
55

56
56
<listitem>
...
...
@@ -58,19 +58,19 @@ tar zxf php-x.x.x
58
58
Configure and build PHP. This is where you customize PHP
59
59
with various options, like which extensions will be enabled. Run
60
60
./configure --help for a list of available options. In our example
61
-
we'll do a simple configure with PHP-FPM and MySQL support.
61
+
we'll do a simple configure with PHP-FPM and MySQLi support.
62
62
</para>
63
63

64
-
<example xml:id="install.unix.nginx.build.php">
64
+
<informalexample xml:id="install.unix.nginx.build.php">
65
65
<screen>
66
66
<![CDATA[
67
67
cd ../php-x.x.x
68
-
./configure --enable-fpm --with-mysql
68
+
./configure --enable-fpm --with-mysqli
69
69
make
70
70
sudo make install
71
71
]]>
72
72
</screen>
73
-
</example>
73
+
</informalexample>
74
74
</listitem>
75
75

76
76
<listitem>
...
...
@@ -78,21 +78,21 @@ sudo make install
78
78
Obtain and move configuration files to their correct locations
79
79
</para>
80
80

81
-
<example xml:id="install.unix.nginx.configure.php">
81
+
<informalexample xml:id="install.unix.nginx.configure.php">
82
82
<screen>
83
83
<![CDATA[
84
84
cp php.ini-development /usr/local/php/php.ini
85
-
cp /usr/local/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf
85
+
cp /usr/local/etc/php-fpm.d/www.conf.default /usr/local/etc/php-fpm.d/www.conf
86
86
cp sapi/fpm/php-fpm /usr/local/bin
87
87
]]>
88
88
</screen>
89
-
</example>
89
+
</informalexample>
90
90
</listitem>
91
91

92
92
<listitem>
93
93
<para>
94
94
It is important that we prevent Nginx from passing requests to the
95
-
PHP-FPM backend if the file does not exists, allowing us to prevent
95
+
PHP-FPM backend if the file does not exist, allowing us to prevent
96
96
arbitrarily script injection.
97
97
</para>
98
98
<para>
...
...
@@ -104,25 +104,25 @@ cp sapi/fpm/php-fpm /usr/local/bin
104
104
Load up php.ini:
105
105
</para>
106
106

107
-
<example xml:id="install.unix.nginx.configure.ini">
107
+
<informalexample xml:id="install.unix.nginx.configure.ini">
108
108
<screen>
109
109
<![CDATA[
110
110
vim /usr/local/php/php.ini
111
111
]]>
112
112
</screen>
113
-
</example>
113
+
</informalexample>
114
114

115
115
<para>
116
116
Locate <literal>cgi.fix_pathinfo=</literal> and modify it as follows:
117
117
</para>
118
118

119
-
<example xml:id="install.unix.nginx.configure.pathinfo">
119
+
<informalexample xml:id="install.unix.nginx.configure.pathinfo">
120
120
<screen>
121
121
<![CDATA[
122
122
cgi.fix_pathinfo=0
123
123
]]>
124
124
</screen>
125
-
</example>
125
+
</informalexample>
126
126
</listitem>
127
127

128
128
<listitem>
...
...
@@ -131,19 +131,19 @@ cgi.fix_pathinfo=0
131
131
www-data and the group www-data before we can start the service:
132
132
</para>
133
133

134
-
<example xml:id="install.unix.nginx.modify.phpfpm">
134
+
<informalexample xml:id="install.unix.nginx.modify.phpfpm">
135
135
<screen>
136
136
<![CDATA[
137
-
vim /usr/local/etc/php-fpm.conf
137
+
vim /usr/local/etc/php-fpm.d/www.conf
138
138
]]>
139
139
</screen>
140
-
</example>
140
+
</informalexample>
141
141

142
142
<para>
143
143
Find and modify the following:
144
144
</para>
145
145

146
-
<example xml:id="install.unix.nginx.modify.phpfpm.usergroup">
146
+
<informalexample xml:id="install.unix.nginx.modify.phpfpm.usergroup">
147
147
<screen>
148
148
<![CDATA[
149
149
; Unix user/group of processes
...
...
@@ -153,19 +153,19 @@ user = www-data
153
153
group = www-data
154
154
]]>
155
155
</screen>
156
-
</example>
156
+
</informalexample>
157
157

158
158
<para>
159
159
The php-fpm service can now be started:
160
160
</para>
161
161

162
-
<example xml:id="install.unix.nginx.start.phpfpm">
162
+
<informalexample xml:id="install.unix.nginx.start.phpfpm">
163
163
<screen>
164
164
<![CDATA[
165
165
/usr/local/bin/php-fpm
166
166
]]>
167
167
</screen>
168
-
</example>
168
+
</informalexample>
169
169

170
170
<para>
171
171
This guide will not configure php-fpm any further, if you are interested
...
...
@@ -178,20 +178,20 @@ group = www-data
178
178
Nginx must now be configured to support the processing of PHP applications:
179
179
</para>
180
180

181
-
<example xml:id="install.unix.nginx.configure.nginx">
181
+
<informalexample xml:id="install.unix.nginx.configure.nginx">
182
182
<programlisting>
183
183
<![CDATA[
184
184
vim /usr/local/nginx/conf/nginx.conf
185
185
]]>
186
186
</programlisting>
187
-
</example>
187
+
</informalexample>
188
188

189
189
<para>
190
190
Modify the default location block to be aware it must attempt
191
191
to serve .php files:
192
192
</para>
193
193

194
-
<example xml:id="install.unix.nginx.configure.nginx.location">
194
+
<informalexample xml:id="install.unix.nginx.configure.nginx.location">
195
195
<programlisting role="nginx-conf">
196
196
<![CDATA[
197
197
location / {
...
...
@@ -200,15 +200,15 @@ location / {
200
200
}
201
201
]]>
202
202
</programlisting>
203
-
</example>
203
+
</informalexample>
204
204

205
205
<para>
206
206
The next step is to ensure that .php files are passed to the
207
-
PHP-FPM backend, blow the commented default PHP location block,
207
+
PHP-FPM backend. Below the commented default PHP location block,
208
208
enter the following:
209
209
</para>
210
210

211
-
<example xml:id="install.unix.nginx.configure.nginx.php">
211
+
<informalexample xml:id="install.unix.nginx.configure.nginx.php">
212
212
<programlisting role="nginx-conf">
213
213
<![CDATA[
214
214
location ~* \.php$ {
...
...
@@ -220,20 +220,20 @@ location ~* \.php$ {
220
220
}
221
221
]]>
222
222
</programlisting>
223
-
</example>
223
+
</informalexample>
224
224

225
225
<para>
226
226
Restart Nginx.
227
227
</para>
228
228

229
-
<example xml:id="install.unix.nginx.restart.nginx">
229
+
<informalexample xml:id="install.unix.nginx.restart.nginx">
230
230
<screen>
231
231
<![CDATA[
232
232
sudo /usr/local/nginx/sbin/nginx -s stop
233
233
sudo /usr/local/nginx/sbin/nginx
234
234
]]>
235
235
</screen>
236
-
</example>
236
+
</informalexample>
237
237
</listitem>
238
238

239
239
<listitem>
...
...
@@ -241,14 +241,14 @@ sudo /usr/local/nginx/sbin/nginx
241
241
Create a test file
242
242
</para>
243
243

244
-
<example xml:id="install.unix.nginx.test.nginx.php">
244
+
<informalexample xml:id="install.unix.nginx.test.nginx.php">
245
245
<screen>
246
246
<![CDATA[
247
247
rm /usr/local/nginx/html/index.html
248
248
echo "<?php phpinfo(); ?>" >> /usr/local/nginx/html/index.php
249
249
]]>
250
250
</screen>
251
-
</example>
251
+
</informalexample>
252
252

253
253
<para>
254
254
Now navigate to http://localhost. The phpinfo() should now be shown.
...
...
@@ -258,7 +258,7 @@ echo "<?php phpinfo(); ?>" >> /usr/local/nginx/html/index.php
258
258

259
259
<para>
260
260
Following the steps above you will have a running Nginx web server with
261
-
support for PHP as a <literal>SAPI</literal> module. Of course there are
261
+
support for PHP as an <literal>FPM</literal> <literal>SAPI</literal> module. Of course there are
262
262
many more configuration options available for Nginx and PHP. For more
263
263
information type <command>./configure --help</command> in the corresponding
264
264
source tree.
265
265