-
Notifications
You must be signed in to change notification settings - Fork 105
/
Copy pathlitespeed.xml
244 lines (206 loc) · 6.64 KB
/
litespeed.xml
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: e8ac70bf549a723cb36465667a6109d9933b8619 Maintainer: anonymous #78453 Status: ready -->
<!-- CREDITS: mowangjuanzi, Luffy -->
<sect1 xml:id="install.unix.litespeed" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Unix 系统下的 LiteSpeed、OpenLiteSpeed Web 服务器</title>
<para>
LiteSpeed PHP 是一个通过 LiteSpeed SAPI 方式和 LiteSpeed 协同工作的 PHP 优化编译器。LSPHP 有自己的进程和独立的二进制包,可用作简单的命令行二进制文件在命令行中执行 PHP 脚本。
</para>
<para>
LSAPI 是一个高度优化的 API,允许 LiteSpeed 与第三方 web 引擎之间进行通信。它的协议和 FCGI 很像,但更加高效。
</para>
<para>
本文档将包含安装和配置 PHP 的 LSAPI,并将 LSAPI 适用于 LiteSpeed Web 服务器和 OpenLiteSpeed Web 服务器。
</para>
<para>
本文档假设 LSWS 或者 OLS 使用默认路径和标记安装。这两个 web 服务器的默认路径为: /usr/local/lsws,并且都可以从 bin 子目录下运行。
</para>
<para>
请注意:本文档中对版本号使用 <literal>x</literal> 替代,以确保本文档在将来保持正确,请根据需要替换对应的版本号。
</para>
<orderedlist>
<listitem>
<para>
要获取和安装 LiteSpeed Web 服务器或者 OpenLiteSpeed Web 服务器,请访问 LiteSpeed Web 服务器文档
<link xlink:href="&url.litespeed.lsws;">安装页面</link>
或者 OpenLiteSpeed 文档
<link xlink:href="&url.litespeed.install;">安装页面</link>.
</para>
</listitem>
<listitem>
<para>
获取并且解压PHP源码:
</para>
<informalexample xml:id="install.unix.litespeed.extract.php">
<screen>
<![CDATA[
mkdir /home/php
cd /home/php
wget http://us1.php.net/get/php-x.x.x.tar.gz/from/this/mirror
tar -zxvf php-x.x.x.tar.gz
cd php-x.x.x
]]>
</screen>
</informalexample>
</listitem>
<listitem>
<para>
配置并构建 PHP。这里可以根据各种选项来定制 PHP,例如需要开启哪些扩展。运行 ./configure --help 可以获得可用的选项列表。在示例中,我们将使用 LiteSpeed Web 服务器默认推荐的配置选项:
</para>
<informalexample xml:id="install.unix.litespeed.build.php">
<screen>
<![CDATA[
./configure ... '--with-litespeed'
make
sudo make install
]]>
</screen>
</informalexample>
</listitem>
<listitem>
<para>
检查 LSPHP 是否安装
</para>
<para>
检查 PHP 是否成功安装的一种最简单的方式是运行以下代码:
</para>
<informalexample>
<screen>
<![CDATA[
cd /usr/local/lsws/fcgi-bin/
./lsphp5 -v
]]>
</screen>
</informalexample>
<para>
它将会返回新构建的 PHP 信息:
</para>
<informalexample>
<screen>
<![CDATA[
PHP 5.6.17 (litespeed) (built: Mar 22 2016 11:34:19)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
]]>
</screen>
</informalexample>
<para>
注意括号中的 <literal>litespeed</literal>。这意味着构建的 PHP 支持 LSAPI。
</para>
</listitem>
</orderedlist>
<para>
按照上面的步骤,LiteSpeed / OpenLiteSpeed Web 服务器已经作为 PHP 的 SAPI 扩展来运行。LSWS / OLS 和 PHP 更多的配置选项,请查看 LiteSpeed 文档:
<link xlink:href="&url.litespeed.php;">PHP</link>。
</para>
<para>
从命令行使用 LSPHP:
</para>
<para>
LSPHP(LSAPI + PHP) 命令行模式,适用于远程服务器上没必要运行 web 服务,
但是又需要处理 PHP 程序的情况。它常用于本地独立的 web 服务器处理 PHP 程序。
这个设置适合将 PHP 的处理拆分到远程服务器上,具有良好的服务可伸缩性。
</para>
<para>
从远程服务器的命令行中启动 lsphp 服务:
LSPHP 是可执行文件,可以手动启动,通过命令行选项 -b socket_address 来绑定到 IPv4,IPv6,或者 Unix 域套接字地址上。
</para>
<para>
例如:
</para>
<para>
LSPHP 绑定到所有 IPv4 和 IPv6 地址的 3000 端口:
</para>
<informalexample>
<screen>
<![CDATA[
/path/to/lsphp -b [::]:3000
]]>
</screen>
</informalexample>
<para>
LSPHP 绑定到所有 IPv4 地址的 3000 端口:
</para>
<informalexample>
<screen>
<![CDATA[
/path/to/lsphp -b *:3000
]]>
</screen>
</informalexample>
<para>
LSPHP 绑定到 192.168.0.2:3000:
</para>
<informalexample>
<screen>
<![CDATA[
/path/to/lsphp -b 192.168.0.2:3000
]]>
</screen>
</informalexample>
<para>
LSPHP 通过 Unix 域套接字<literal>/tmp/lsphp_manual.sock</literal> 接受请求:
</para>
<informalexample>
<screen>
<![CDATA[
/path/to/lsphp -b /tmp/lsphp_manual.sock
]]>
</screen>
</informalexample>
<para>
在 LSPHP 执行前设置环境变量:
</para>
<informalexample>
<screen>
<![CDATA[
PHP_LSAPI_MAX_REQUESTS=500 PHP_LSAPI_CHILDREN=35 /path/to/lsphp -b IP_address:port
]]>
</screen>
</informalexample>
<para>
目前 LiteSpeed PHP 可适用于 LiteSpeed Web 服务器,OpenLiteSpeed Web 服务器和 Apache mod_lsapi 一起使用。有关服务器端的配置的步骤,请浏览相关的文档页面:
<link xlink:href="&url.litespeed.web.server;">LiteSpeed Web 服务器</link>
和 <link xlink:href="&url.litespeed.open;">OpenLiteSpeed</link>。
</para>
<para>
LSPHP 也可以通过其它的方式来安装。
</para>
<para>
CentOS:
在 CentOS 系统中,LSPHP 可以从 LiteSpeed 存储库或 Remi 存储库中通过 <link xlink:href="&url.litespeed.packages;">RPM</link> 的方式安装。
</para>
<para>
Debian:
在 Debian 系统中,LSPHP 可以从 LiteSpeed 存储库中通过 <link xlink:href="&url.litespeed.packages;">apt</link> 的方式安装。
</para>
<para>
cPanel:
访问相应的<link xlink:href="&url.litespeed.cpanel;">文档页面</link>了解如何通过 cPanel 和 LSWS/OLS 在 EasyApache4 中安装 LSPHP。
</para>
<para>
Plesk:
Plesk 可以在 CentOS,CloudLinux,Debian 和 Ubuntu 上使用 LSPHP,想获取更多的信息,请参考对应的<link xlink:href="&url.litespeed.plesk;">文档页面</link>
</para>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->