当前位置: 操作系统/服务器>linux
本页文章导读:
▪IIS7.5应用程序池集成模式和经典模式的区别介绍
升级过程中出现了比较多的问题,前面文章也提到过几个。这次就主要介绍下httpHandler 和 httpModule 在集成和经典模式下的区别。很多文件上传等都是需要使用到httpModule去实现。我今天就出.........
▪CentOS 6.1 环境中部署nginx、php(包括fastcgi)、虚拟主机配置
部署时间:2012-07-24 OS环境:CentOS 6.1 nginx:nginx-1.2.2 PHP:PHP5.3.14 0、安装依赖包 代码如下:yum install openssl-devel pcre-devel zlib-devel libjpeg-devel libpng-devel freetype-devel gcc make 1、添加 www 用户用来执.........
▪iis7.0命令行下列网站的物理目录的代码
CD %systemroot%\system32\Inetsrv\ 如果您运行的是 64 位 Windows,请从 %windir%\system32\inetsrv 目录而不是 %windir%\syswow64\inetsrv 目录中使用 Appcmd.exe。 C:\Windows\System32\inetsrv>appcmd list VDIR VDIR "Default Web Site/.........
[1]IIS7.5应用程序池集成模式和经典模式的区别介绍
来源: 互联网 发布时间: 2013-12-24
升级过程中出现了比较多的问题,前面文章也提到过几个。这次就主要介绍下httpHandler 和 httpModule 在集成和经典模式下的区别。很多文件上传等都是需要使用到httpModule去实现。我今天就出现了NeatUpload在iis7.5下出现未将对象引用到设计实例的错误。所以用httpModule作为测试案例。
1.新建测试网站WebApplication,加入MyHttpModule类实现IHttpModule接口,主要目的是测试程序是否经过了HttpModule,经过的在页面输出HttpModule字符。
public class MyHttpModule : IHttpModule
{
public void Dispose()
{
}
public void Init(HttpApplication context)
{
context.BeginRequest += context_BeginRequest;
}
protected void context_BeginRequest(object sender, EventArgs e)
{
var context = sender as HttpApplication;
context.Response.Clear();
context.Response.Write("HttpModule");
context.Response.End();
}
}
2、2.在IIS7.5部署网站,首先使用经典模式应用程序池。在web.config的 <system.web> 的子节点<httpModules> 加入<add name="MyHttpModule" type="WebApplication.MyHttpModule, WebApplication"/>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="MyHttpModule" type="WebApplication.MyHttpModule, WebApplication"/>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
访问网站可以发现页面输出如下,说明程序经过了HttpModule 直接切换应用程序池成集成模式会发现页面输出为空。证明程序没有经过HttpModule。那在集成模式下HttpModule如何才能执行呢? 之前部署URLRewriter的时候查资料只知道需要 <system.webServer> <modules>注册HttpModule。仔细查看配置文件会发现有一段如下英文.意思大概就是iis7版本的设置。之前版本无需设置。
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
这样就大概明白意思是iis7.0之后有部分web配置移动到system.webServer中。查阅相关得到答案确实如此 详细资料见 http://www.cnblogs.com/buaaboyi/archive/2011/01/20/1939903.html
于是在<system.webServer> <modules>中加入配置如下,刷新页面,页面能够输出字符HttpModule,证明成功了。
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<remove name="ScriptModule" />
<add name="MyHttpModule" type="WebApplication.MyHttpModule, WebApplication"/>
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>
由于在升级过程成有一个站点出现 HTTP 错误 500.22 - Internal Server Error 检测到在集成的托管管道模式下不适用的 ASP.NET 设置
1.新建测试网站WebApplication,加入MyHttpModule类实现IHttpModule接口,主要目的是测试程序是否经过了HttpModule,经过的在页面输出HttpModule字符。
代码如下:
public class MyHttpModule : IHttpModule
{
public void Dispose()
{
}
public void Init(HttpApplication context)
{
context.BeginRequest += context_BeginRequest;
}
protected void context_BeginRequest(object sender, EventArgs e)
{
var context = sender as HttpApplication;
context.Response.Clear();
context.Response.Write("HttpModule");
context.Response.End();
}
}
2、2.在IIS7.5部署网站,首先使用经典模式应用程序池。在web.config的 <system.web> 的子节点<httpModules> 加入<add name="MyHttpModule" type="WebApplication.MyHttpModule, WebApplication"/>
代码如下:
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="MyHttpModule" type="WebApplication.MyHttpModule, WebApplication"/>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
访问网站可以发现页面输出如下,说明程序经过了HttpModule 直接切换应用程序池成集成模式会发现页面输出为空。证明程序没有经过HttpModule。那在集成模式下HttpModule如何才能执行呢? 之前部署URLRewriter的时候查资料只知道需要 <system.webServer> <modules>注册HttpModule。仔细查看配置文件会发现有一段如下英文.意思大概就是iis7版本的设置。之前版本无需设置。
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
这样就大概明白意思是iis7.0之后有部分web配置移动到system.webServer中。查阅相关得到答案确实如此 详细资料见 http://www.cnblogs.com/buaaboyi/archive/2011/01/20/1939903.html
于是在<system.webServer> <modules>中加入配置如下,刷新页面,页面能够输出字符HttpModule,证明成功了。
代码如下:
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<remove name="ScriptModule" />
<add name="MyHttpModule" type="WebApplication.MyHttpModule, WebApplication"/>
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>
由于在升级过程成有一个站点出现 HTTP 错误 500.22 - Internal Server Error 检测到在集成的托管管道模式下不适用的 ASP.NET 设置
当时在比较急的情况下就直接删除了 <system.web> 的子节点<httpModules> 程序正常运行。后面通过仔细和正常的站点对比是发现是缺少 <validation validateIntegratedModeConfiguration="false"/> 这个导致,这个主要作用是设置不检测 <system.web>中的配置
经过这今天的折腾终于是对iis7.5上的部署有了一定了解了。
[2]CentOS 6.1 环境中部署nginx、php(包括fastcgi)、虚拟主机配置
来源: 互联网 发布时间: 2013-12-24
部署时间:2012-07-24
OS环境:CentOS 6.1
nginx:nginx-1.2.2
PHP:PHP5.3.14
0、安装依赖包
1、添加 www 用户用来执行nginx
2、创建临时目录
mkdir -p /var/tmp/nginx/client/
mkdir -p /var/tmp/nginx/proxy/
mkdir -p /var/tmp/nginx/fcgi/
3、下载nginx最新稳定版源代码
cd /usr/local/src/
wget http://nginx.org/download/nginx-1.2.2.tar.gz
4、解压,编译,安装
tar vxzf nginx-1.2.2.tar.gz
cd nginx-1.2.2/
./configure \
--prefix=/opt/web/nginx \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--user=www \
--group=www \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/var/tmp/nginx/client/ \
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi/
make
make install
5、配置nginx
vim /opt/web/nginx/conf/nginx.conf
# 指定启动用户:
user www www;
# 进程数量,nginx作者认为一个就可以,根据自己的访问量修改
worker_processes 1;
# 设置错误日志:
#error_log logs/error.log notice;
#error_log logs/error.log info;
error_log /var/log/nginx/error.default.log;
pid /opt/web/nginx/nginx.pid;
events {
use epoll;
worker_connections 1024;
}
http {
charset utf-8;
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
gzip_min_length 1000;
gzip_proxied any;
gzip_types text/plain text/css text/xml
application/x-javascript application/xml
application/atom+xml text/javascript;
server {
listen 80;
server_name localhost;
charset utf-8;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
#include fastcgi_params;
include fastcgi.conf;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
proxy_read_timeout 200;
# Only retry if there was a communication error, not a timeout
# on the Tornado server (to avoid propagating "queries of death"
# to all frontends)
proxy_next_upstream error;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 引入虚拟主机文件
include /opt/web/nginx/conf/sites/*.conf;
}
6、建立虚拟机配置文件存放的目录
这样配置后,需要新增加虚拟主机的直接在 nginx/conf/sites/目录下,添加配置文件即可
例如:现在有 www. 域名
建立:/opt/web/nginx/conf/sites/www..conf 文件
内容如下:
server {
listen 80;
client_max_body_size 10M;
#多个域名用空格分割,第一个为默认
server_name www. ;
charset UTF-8;
index index.html index.htm index.php;
# 定义根目录
set $root /var/webroot/www./;
# 设置站点路径
root $root;
# 防止目录浏览
autoindex off;
if ($host != 'www.') {
rewrite ^/(.*)$ http://www./$1 permanent;
}
# 防止.htaccess文件被请求
location ~ /\.ht {
deny all;
}
error_page 404 /404.html;
index index.html index.htm;
location /uploads/ {
alias /data/webroot/www./uploads/;
}
try_files $uri @uwsgi;
location @uwsgi{
# 将其它的请求转交给uwsgi
include uwsgi_params;
uwsgi_pass unix:/tmp/360ito_uwsgi.sock;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_pass http://localhost:5000;
}
# 将php类型的请求转交给fastcgi
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
# 访问日志:
access_log /var/log/nginx/access.www..log;
# 加载.htaccess重写文件,注意,这里不支持变量路径
# 不能写成 include $root/www./.htaccess;
# include /var/webroot/www./.htaccess;
# 开启域名跳转,则当访问出错后,其他域名会自动跳转到 www.
# 注意,这里我说的是,仅仅当访问出错后,才会跳转,所以,这里并不能实现301重定向!
server_name_in_redirect on;
}
7、安装最新版本PHP( PHP5.3.14 )
cd /usr/local/src/
wget http://cn.php.net/get/php-5.3.14.tar.bz2/from/this/mirror
tar xjvf php-5.3.14.tar.bz2
cd php-5.3.14
执行:
如果报错,可能是你的 autoconf不是 2.13 版本的,PHP5.3.系列的bug,需要安装 autoconf为2.13的版本:
CentOS : # yum install autoconf213
Debian : # apt-get install autoconf2.13
设置环境变量
# CentOS :
export PHP_AUTOCONF="/usr/bin/autoconf-2.13"
# Debian :
export PHP_AUTOCONF="/usr/bin/autoconf2.13"
再次运行:./buildconf --force ,出现 buildconf: autoconf version 2.13 (ok)
,则表示成功。
编译安装 PHP
./configure \
--prefix=/opt/web/php \
--with-config-file-path=/opt/web/php/etc \
--with-config-file-scan-dir=/opt/web/php/etc/conf.d \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--with-mysql=/opt/db/Percona-Server-5.5.14-rel20.5 \
--with-mysqli=/opt/db/Percona-Server-5.5.14-rel20.5/bin/mysql_config \
--with-iconv-dir \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir \
--enable-xml \
--enable-mbstring \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--enable-inline-optimization
make && make install
cp php.ini-production /opt/web/php/etc/php.ini
cd /opt/web/php/etc
cp php-fpm.conf.default php-fpm.conf
修改php-fpm.conf 启用如下几行,即去掉前面的分号(;)
pid = run/php-fpm.pid
error_log = log/php-fpm.log
log_level = notice
listen = 127.0.0.1:9000
listen.allowed_clients = 127.0.0.1
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
8、启动php-fpm
启动nginx
9、测试一下
输入和保存
<?PHP
phpinfo();
?>
10、在浏览器地址栏输入:http://php./tz.php
成功的话,可以看到phpinfo()输出的信息
OS环境:CentOS 6.1
nginx:nginx-1.2.2
PHP:PHP5.3.14
0、安装依赖包
代码如下:
yum install openssl-devel pcre-devel zlib-devel libjpeg-devel libpng-devel freetype-devel gcc make
1、添加 www 用户用来执行nginx
代码如下:
useradd -M -r -s /sbin/nologin -d /opt/web/ www
2、创建临时目录
代码如下:
mkdir -p /var/tmp/nginx/client/
mkdir -p /var/tmp/nginx/proxy/
mkdir -p /var/tmp/nginx/fcgi/
3、下载nginx最新稳定版源代码
代码如下:
cd /usr/local/src/
wget http://nginx.org/download/nginx-1.2.2.tar.gz
4、解压,编译,安装
代码如下:
tar vxzf nginx-1.2.2.tar.gz
cd nginx-1.2.2/
./configure \
--prefix=/opt/web/nginx \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--user=www \
--group=www \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/var/tmp/nginx/client/ \
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi/
make
make install
5、配置nginx
代码如下:
vim /opt/web/nginx/conf/nginx.conf
# 指定启动用户:
user www www;
# 进程数量,nginx作者认为一个就可以,根据自己的访问量修改
worker_processes 1;
# 设置错误日志:
#error_log logs/error.log notice;
#error_log logs/error.log info;
error_log /var/log/nginx/error.default.log;
pid /opt/web/nginx/nginx.pid;
events {
use epoll;
worker_connections 1024;
}
http {
charset utf-8;
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
gzip_min_length 1000;
gzip_proxied any;
gzip_types text/plain text/css text/xml
application/x-javascript application/xml
application/atom+xml text/javascript;
server {
listen 80;
server_name localhost;
charset utf-8;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
#include fastcgi_params;
include fastcgi.conf;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
proxy_read_timeout 200;
# Only retry if there was a communication error, not a timeout
# on the Tornado server (to avoid propagating "queries of death"
# to all frontends)
proxy_next_upstream error;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 引入虚拟主机文件
include /opt/web/nginx/conf/sites/*.conf;
}
6、建立虚拟机配置文件存放的目录
代码如下:
mkdir /opt/web/nginx/conf/sites
这样配置后,需要新增加虚拟主机的直接在 nginx/conf/sites/目录下,添加配置文件即可
例如:现在有 www. 域名
建立:/opt/web/nginx/conf/sites/www..conf 文件
内容如下:
代码如下:
server {
listen 80;
client_max_body_size 10M;
#多个域名用空格分割,第一个为默认
server_name www. ;
charset UTF-8;
index index.html index.htm index.php;
# 定义根目录
set $root /var/webroot/www./;
# 设置站点路径
root $root;
# 防止目录浏览
autoindex off;
if ($host != 'www.') {
rewrite ^/(.*)$ http://www./$1 permanent;
}
# 防止.htaccess文件被请求
location ~ /\.ht {
deny all;
}
error_page 404 /404.html;
index index.html index.htm;
location /uploads/ {
alias /data/webroot/www./uploads/;
}
try_files $uri @uwsgi;
location @uwsgi{
# 将其它的请求转交给uwsgi
include uwsgi_params;
uwsgi_pass unix:/tmp/360ito_uwsgi.sock;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_pass http://localhost:5000;
}
# 将php类型的请求转交给fastcgi
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
# 访问日志:
access_log /var/log/nginx/access.www..log;
# 加载.htaccess重写文件,注意,这里不支持变量路径
# 不能写成 include $root/www./.htaccess;
# include /var/webroot/www./.htaccess;
# 开启域名跳转,则当访问出错后,其他域名会自动跳转到 www.
# 注意,这里我说的是,仅仅当访问出错后,才会跳转,所以,这里并不能实现301重定向!
server_name_in_redirect on;
}
7、安装最新版本PHP( PHP5.3.14 )
代码如下:
cd /usr/local/src/
wget http://cn.php.net/get/php-5.3.14.tar.bz2/from/this/mirror
tar xjvf php-5.3.14.tar.bz2
cd php-5.3.14
执行:
代码如下:
./buildconf --force
如果报错,可能是你的 autoconf不是 2.13 版本的,PHP5.3.系列的bug,需要安装 autoconf为2.13的版本:
代码如下:
CentOS : # yum install autoconf213
Debian : # apt-get install autoconf2.13
设置环境变量
代码如下:
# CentOS :
export PHP_AUTOCONF="/usr/bin/autoconf-2.13"
# Debian :
export PHP_AUTOCONF="/usr/bin/autoconf2.13"
再次运行:./buildconf --force ,出现 buildconf: autoconf version 2.13 (ok)
,则表示成功。
编译安装 PHP
代码如下:
./configure \
--prefix=/opt/web/php \
--with-config-file-path=/opt/web/php/etc \
--with-config-file-scan-dir=/opt/web/php/etc/conf.d \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--with-mysql=/opt/db/Percona-Server-5.5.14-rel20.5 \
--with-mysqli=/opt/db/Percona-Server-5.5.14-rel20.5/bin/mysql_config \
--with-iconv-dir \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir \
--enable-xml \
--enable-mbstring \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--enable-inline-optimization
make && make install
cp php.ini-production /opt/web/php/etc/php.ini
cd /opt/web/php/etc
cp php-fpm.conf.default php-fpm.conf
修改php-fpm.conf 启用如下几行,即去掉前面的分号(;)
代码如下:
pid = run/php-fpm.pid
error_log = log/php-fpm.log
log_level = notice
listen = 127.0.0.1:9000
listen.allowed_clients = 127.0.0.1
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
8、启动php-fpm
代码如下:
/opt/web/php/sbin/php-fpm
启动nginx
代码如下:
/opt/web/nginx/sbin/nginx
9、测试一下
代码如下:
vim /var/webroot/www./tz.php
输入和保存
代码如下:
<?PHP
phpinfo();
?>
10、在浏览器地址栏输入:http://php./tz.php
成功的话,可以看到phpinfo()输出的信息
[3]iis7.0命令行下列网站的物理目录的代码
来源: 互联网 发布时间: 2013-12-24
CD %systemroot%\system32\Inetsrv\
如果您运行的是 64 位 Windows,请从 %windir%\system32\inetsrv 目录而不是 %windir%\syswow64\inetsrv 目录中使用 Appcmd.exe。
C:\Windows\System32\inetsrv>appcmd list VDIR
VDIR "Default Web Site/" (physicalPath:%SystemDrive%\inetpub\wwwroot)
VDIR "Default Web Site/PerlEx/" (physicalPath:C:\Perl\eg\PerlEx)
VDIR "test/" (physicalPath:C:\inetpub\other)
VDIR "test/t" (physicalPath:C:\inetpub\other)
可惜了,要管理员权限.
如果您运行的是 64 位 Windows,请从 %windir%\system32\inetsrv 目录而不是 %windir%\syswow64\inetsrv 目录中使用 Appcmd.exe。
C:\Windows\System32\inetsrv>appcmd list VDIR
VDIR "Default Web Site/" (physicalPath:%SystemDrive%\inetpub\wwwroot)
VDIR "Default Web Site/PerlEx/" (physicalPath:C:\Perl\eg\PerlEx)
VDIR "test/" (physicalPath:C:\inetpub\other)
VDIR "test/t" (physicalPath:C:\inetpub\other)
可惜了,要管理员权限.
最新技术文章: