- 浏览: 849706 次
- 性别:
- 来自: lanzhou
文章分类
最新评论
-
liu346435400:
楼主讲了实话啊,中国程序员的现状,也是只见中国程序员拼死拼活的 ...
中国的程序员为什么这么辛苦 -
qw8226718:
国内ASP.NET下功能比较完善,优化比较好的Spacebui ...
国内外开源sns源码大全 -
dotjar:
敢问兰州的大哥,Prism 现在在12.04LTS上可用么?我 ...
最佳 Ubuntu 下 WebQQ 聊天体验 -
coralsea:
兄弟,卫星通信不是这么简单的,单向接收卫星广播信号不需要太大的 ...
Google 上网 -
txin0814:
我成功安装chrome frame后 在IE地址栏前加上cf: ...
IE中使用Google Chrome Frame运行HTML 5
This tutorial describes how you can install Apache2 with mod_fcgid and PHP5 on Ubuntu 9.04. mod_fcgid is a compatible alternative to the older mod_fastcgi. It lets you execute PHP scripts with the permissions of their owners instead of the Apache user. I do not issue any guarantee that this will work for you! I'm using an Ubuntu 9.04 server in this tutorial with the hostname server1.example.com and the IP address192.168.0.100. I will create two Apache vhosts in this tutorial, www.example1.com and www.example2.com, to demonstrate the usage of mod_fcgid. Make sure you're logged in as root: sudo su /bin/sh is a symlink to /bin/dash, however we need /bin/bash, not /bin/dash. Therefore we do this: dpkg-reconfigure dash Install dash as /bin/sh? <-- No In addition to that, we must disable AppArmor: /etc/init.d/apparmor stop In order to install Apache2, mod_fcgid, and PHP5, run aptitude install apache2 apache2-suexec libapache2-mod-fcgid php5-cgi If Apache2 was already installed with PHP5 as an Apache module, disable the PHP5 module now: a2dismod php5 Then enable the following modules... a2enmod rewrite ... and open /etc/php5/cgi/php.ini: vi /etc/php5/cgi/php.ini Add the line cgi.fix_pathinfo = 1 right at the end of the file: Then restart Apache: /etc/init.d/apache2 restart I will now create two vhosts, www.example1.com (with the document root /var/www/web1/web) and www.example2.com(with the document root /var/www/web2/web). www.example1.com will be owned by the user and group web1, andwww.example2.com by the user and group web2. First we create the users and groups: groupadd web11 Preliminary Note
update-rc.d -f apparmor remove
aptitude remove apparmor apparmor-utils2 Installing Apache2/mod_fcgi/PHP5
a2enmod suexec
a2enmod include
a2enmod fcgid
[...]
cgi.fix_pathinfo = 1
3 Creating Vhosts For www.example1.com And www.example2.com
groupadd web2
useradd -s /bin/false -d /var/www/web1 -m -g web1 web1
useradd -s /bin/false -d /var/www/web2 -m -g web2 web2
Then we create the document roots and make them owned by the users/groups web1 resp. web2:
mkdir -p /var/www/web1/web
chown web1:web1 /var/www/web1/web
mkdir -p /var/www/web2/web
chown web2:web2 /var/www/web2/web
We will run PHP using suExec; suExec's document root is /var/www, as the following command shows:
/usr/lib/apache2/suexec -V
root@server1:~# /usr/lib/apache2/suexec -V
-D AP_DOC_ROOT="/var/www"
-D AP_GID_MIN=100
-D AP_HTTPD_USER="www-data"
-D AP_LOG_EXEC="/var/log/apache2/suexec.log"
-D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin"
-D AP_UID_MIN=100
-D AP_USERDIR_SUFFIX="public_html"
root@server1:~#
Therefore we cannot call the PHP binary (/usr/lib/cgi-bin/php) directly because it is located outside suExec's document root. As suExec does not allow symlinks, the only way to solve the problem is to create a wrapper script for each web site in a subdirectory of /var/www; the wrapper script will then call the PHP binary /usr/lib/cgi-bin/php. The wrapper script must be owned by the user and group of each web site, therefore we need one wrapper script for each web site. I'm going to create the wrapper scripts in subdirectories of /var/www/php-fcgi-scripts, e.g. /var/www/php-fcgi-scripts/web1 and /var/www/php-fcgi-scripts/web2.
mkdir -p /var/www/php-fcgi-scripts/web1
mkdir -p /var/www/php-fcgi-scripts/web2
vi /var/www/php-fcgi-scripts/web1/php-fcgi-starter
#!/bin/sh PHPRC=/etc/php5/cgi/ export PHPRC export PHP_FCGI_MAX_REQUESTS=5000 export PHP_FCGI_CHILDREN=8 exec /usr/lib/cgi-bin/php |
vi /var/www/php-fcgi-scripts/web2/php-fcgi-starter
#!/bin/sh PHPRC=/etc/php5/cgi/ export PHPRC export PHP_FCGI_MAX_REQUESTS=5000 export PHP_FCGI_CHILDREN=8 exec /usr/lib/cgi-bin/php |
The PHPRC line contains the directory where the php.ini file is located (i.e., /etc/php5/cgi/ translates to/etc/php5/cgi/php.ini). PHP_FCGI_MAX_REQUESTS is the maximum number of requests before an fcgid process is stopped and a new one is launched. PHP_FCGI_CHILDREN defines the number of PHP children that will be launched.
The php-fcgi-starter scripts must be executable, and they (and the directories they are in) must be owned by the web site's user and group:
chmod 755 /var/www/php-fcgi-scripts/web1/php-fcgi-starter
chmod 755 /var/www/php-fcgi-scripts/web2/php-fcgi-starter
chown -R web1:web1 /var/www/php-fcgi-scripts/web1
chown -R web2:web2 /var/www/php-fcgi-scripts/web2
Now we create the Apache vhosts for www.example1.com and www.example2.com:
vi /etc/apache2/sites-available/web1
<VirtualHost *:80> ServerName www.example1.com ServerAlias example1.com ServerAdmin webmaster@example1.com DocumentRoot /var/www/web1/web/ <IfModule mod_fcgid.c> SuexecUserGroup web1 web1 PHP_Fix_Pathinfo_Enable 1 <Directory /var/www/web1/web/> Options +ExecCGI AllowOverride All AddHandler fcgid-script .php FCGIWrapper /var/www/php-fcgi-scripts/web1/php-fcgi-starter .php Order allow,deny Allow from all </Directory> </IfModule> # ErrorLog /var/log/apache2/error.log # CustomLog /var/log/apache2/access.log combined ServerSignature Off </VirtualHost> |
a2ensite web1
vi /etc/apache2/sites-available/web2
<VirtualHost *:80> ServerName www.example2.com ServerAlias example2.com ServerAdmin webmaster@example2.com DocumentRoot /var/www/web2/web/ <IfModule mod_fcgid.c> SuexecUserGroup web2 web2 PHP_Fix_Pathinfo_Enable 1 <Directory /var/www/web2/web/> Options +ExecCGI AllowOverride All AddHandler fcgid-script .php FCGIWrapper /var/www/php-fcgi-scripts/web2/php-fcgi-starter .php Order allow,deny Allow from all </Directory> </IfModule> # ErrorLog /var/log/apache2/error.log # CustomLog /var/log/apache2/access.log combined ServerSignature Off </VirtualHost> |
a2ensite web2
Make sure you fill in the right paths (and the correct user and group in the SuexecUserGroup line).
Reload Apache afterwards:
/etc/init.d/apache2 reload
发表评论
-
十八个绝招把你从压力中营救出来
2010-03-08 10:34 990面对目前的工作与生活,你是否感觉到快要被逼疯了,来自工作的,家 ... -
Chrome扩展页面无法访问的解决办法
2010-03-03 09:04 1304Google推出Chrome扩展页面后有些中国的网友可能访 ... -
程序员礼仪小知识
2010-02-28 18:37 932常用应酬语: ... -
How GitHub Works
2010-02-22 07:53 755Ryan wrote a really great comme ... -
XXXX对80后的30个忠告
2010-02-09 11:10 7781、一个年轻人,如果 ... -
汇总Windows7系统常见5个问题和解决方法
2010-01-27 10:08 9621、DVD音频问题 微软改进了Windows7的硬件 ... -
MHDD找不到硬盘的解决方案
2010-01-27 09:48 4548硬盘要接在SATA0和SATA1上, 只认两个通道. 并且 ... -
NetBeans中文乱码解决办法
2010-01-15 07:56 2222在Windows 和Linux(Fedora/Ubuntu/ ... -
时间管理的6条黄金法则
2009-11-22 06:52 1124“时间就是金钱,效 ... -
从15个小动作猜准上司心思
2009-11-22 06:44 966察言观色是一切人情往 ... -
Fixing Poor MySQL Default Configuration Values
2009-11-15 13:24 948I've recently been accumulating ... -
100 Terrific Tips & Tools for Blogging Librarians
2009-11-14 09:43 2223As you prepare for a career as ... -
基本交际用语
2009-11-10 13:04 776日常生活中少不了要面对各种各样的场景和形 ... -
送你一副巧嘴——实用交际用语
2009-11-10 13:02 1650送你一副巧嘴 现代中 ... -
职场红人必读超级商务英语句子
2009-11-09 23:29 8581 I've come to make sure tha ... -
7 Things To Do After Installing Windows 7
2009-11-09 08:38 8391. Reinstall 7 if you purchased ... -
做个给WIN7减肥的批处理的想法,方便去实施
2009-11-08 09:34 2418首先 开启 Administrator 用户 删除其他用户!这 ... -
Windows 7超级实用的快速操作技巧
2009-11-08 07:35 985如果你已经升级到 Window ... -
使windows7更好用,10个很有用的Win7技巧
2009-11-08 07:29 1216没错,这些都是Windows 7带给我们的新东西,而且你很有必 ... -
电脑利用firefox模拟访问WAP版网站
2009-11-05 11:27 4694最近由于一些项目的原因,需要使用手机访问一些wap网站,从而参 ...
相关推荐
Apache mod_fcgid 是一个非常重要的模块,它允许Apache HTTP Server与FastCGI应用程序进行通信,从而提升服务器性能和响应速度。FastCGI是一种常驻型的CGI(Common Gateway Interface)实现,它解决了传统CGI模式下...
在安装Redmine 2.5.3时,`mod_fcgid`是必要的组件,因为它允许Apache与Ruby on Rails应用(如Redmine)通过FastCGI接口进行通信。安装步骤通常如下: 1. 下载`mod_fcgid-2.3.9`压缩包并解压。 2. 使用Apache的开发...
5. **modules**:可能是一个包含Apache模块的目录,其中可能包含mod_fcgid的二进制文件。 6. **manual**:可能是mod_fcgid的用户手册或文档,详细解释了如何配置和使用该模块。 综上所述,这个zip文件提供了在...
标题中的"mod_fcgid-2.3.10-win32-VS16_javascript_socket_MOD_"提及的是一个特定版本的Apache模块mod_fcgid的Windows 32位构建,该版本是使用Visual Studio 16(可能是VS2019)编译的,并且与JavaScript Socket编程...
Apache mod_fcgid 用于 Apache HTTP Server 的 FastCGI 模块作为 2.3.9 发布。
32位Apache FCGID模块,已确认切实可用,验证Apache版本:2.4
mod_fcgid-2.3.9 x64 适用于Windows平台Apache 2.4 亲测可用
Apache2.4 Win64位 配置PHP: #----------------Fastcgi-------------------------------- LoadModule fcgid_module modules/mod_fcgid.so <IfModule mod_fcgid.c> FcgidMaxRequestsPerProcess 1000 ...
标题中的"mod_fcgid-2.3.10-win32-VS16_javascript_socket_MOD_源码.rar"指示我们关注的是一个名为mod_fcgid的软件模块的源代码,版本为2.3.10,适配于Windows 32位系统,并且与Visual Studio 2016(VS16)开发环境...
mod_fcgid.so
2. mod_fcgid:作为Apache的模块,mod_fcgid负责管理和调度FastCGI进程。它支持多种脚本语言,如PHP、Perl、Python等,提供了一种高效且可靠的Web服务器扩展解决方案。 3. 进程管理策略:mod_fcgid的进程管理策略...
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
在Debian/Ubuntu系统中,可以通过`sudo apt-get install libapache2-mod-fcgid`命令安装;在CentOS/RHEL系统中,可以使用`sudo yum install mod_fcgid`。安装完成后,确保在`httpd.conf`文件中加载该模块,添加或...
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
离线安装包,亲测可用
Win环境下安装Apache2+fastcgi+php5(non thread safe)+MySql5+ZendGuardLoader
查看apache日志,发觉是mod_fcgid模块异常,提示”Connection reset by peer:mod_fcgid:error reading data from FastCGI server”、”Premature end of script headers:index.php”、”process /usr/… apache/cgi-...
- 解压缩下载的文件,并将其中 `modules` 文件夹下的 `mod_fcgid.so` 文件复制到 Apache 的 `modules` 目录下。 - **配置 Apache**: - 修改 `httpd.conf` 配置文件: - 在 `<Directory>` 块中添加 `Options ...