亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

win2003下nginx 0.8.38 安裝配置備忘

 更新時(shí)間:2010年12月17日 10:12:48   作者:  
經(jīng)不住蠱惑,決定在 Windows Server 2003 下安裝試用一下,并與 PHP 進(jìn)行集成。
據(jù)說(shuō) nginx 是這幾年來(lái) Web 服務(wù)器的后起之秀,是“Apache殺手”,由俄羅斯程序員編寫(xiě)。是一個(gè)輕量級(jí)的 Web 服務(wù)器,也是據(jù)說(shuō),占用資源少,高并發(fā),在某些情況下,效率是 Apache 的 10 倍。國(guó)內(nèi)外很多大型門戶站都在用。

經(jīng)不住蠱惑,決定在 Windows Server 2003 下安裝試用一下,并與 PHP 進(jìn)行集成。

截至 2010 年 5 月底,nginx 的最新版本是 0.8.38,可以到 http://www.nginx.org/ 下載。

解壓 PHP 到 C:\php-5.3.2-Win32-VC6-x86\,正確配置 php.ini 文件。

直接解壓下載的 nginx-0.8.38.zip 文件到 C:\nginx-0.8.38\,文件夾結(jié)構(gòu):

conf\
contrib\
docs\
html\
logs\
temp\
nginx.exe

雙擊運(yùn)行nginx.exe文件,nginx 就開(kāi)始提供服務(wù)。
html\ 文件夾為網(wǎng)站默認(rèn)根目錄。
conf\ 放置 nginx 配置有關(guān)的文件。配置文件 nginx.conf 內(nèi)容如下(#號(hào)打頭的語(yǔ)句被注釋掉了,可以參考):

server {……} 部分配制了 nginx 的 http 服務(wù)的端口(默認(rèn)為80)、域名、字符集、根文件夾、首頁(yè)文件等內(nèi)容。

其中以下部分配置 nginx 與 PHP 以 fastcgi 方式進(jìn)行集成,“C:/nginx-0.8.38/html”表示網(wǎng)站的根文件夾:
復(fù)制代碼 代碼如下:

location ~ \.php$ {
# root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME C:/nginx-0.8.38/html$fastcgi_script_name;
include fastcgi_params;
}

#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
worker_connections 1024;
}

http {
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;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root html;
index index.html index.htm;
autoindex on;
}

#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 C:/nginx-0.8.38/html$fastcgi_script_name;
include fastcgi_params;
}

# 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 ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}
}

這時(shí),在本機(jī)上打開(kāi)瀏覽器,瀏覽 http://localhost,可以看到信息“Welcome to nginx!”,內(nèi)容來(lái)自 html 下的 index.html 文件。

為了真正與 PHP 一起協(xié)同工作,還必須運(yùn)行 PHP 的 php-cgi.exe 程序。方法是,在命令窗口內(nèi),切換到 php-cgl.exe 所在文件夾,運(yùn)行下,即 C:\php-5.3.2-Win32-VC6-x86,運(yùn)行 php-cgi.exe -b 127.0.0.1:9000 命令,即:

C:\php-5.3.2-Win32-VC6-x86〉php-cgi.exe -b 127.0.0.1:9000

這里的127.0.0.1:9000 就是我們?cè)?nginx.conf 文件中配置的那個(gè),端口號(hào)一定要相同。

nginx.exe 與 php-cgi.exe 兩條命令運(yùn)行的前后順序?qū)?PHP 文件的解析沒(méi)有影響。

這時(shí),我們?cè)诟夸浵路乓粋€(gè) xxx.php 文件,在瀏覽器地址欄里面輸入 http://localhost/xxx.php,應(yīng)該看到結(jié)果。建議文件內(nèi)容為:

<?php
phpinfo();
?>

我們可以看到 PHP 環(huán)境的很多有用的信息。

nginx 還可以配置實(shí)現(xiàn)反向代理、多個(gè)虛擬主機(jī)、url重定向等功能。

相關(guān)文章

  • Nginx利用Lua+Redis實(shí)現(xiàn)動(dòng)態(tài)封禁IP的方法

    Nginx利用Lua+Redis實(shí)現(xiàn)動(dòng)態(tài)封禁IP的方法

    在站點(diǎn)遇到攻擊且無(wú)明顯攻擊特征,造成站點(diǎn)訪問(wèn)慢,nginx不斷返回502等錯(cuò)誤時(shí),可利用nginx+lua+redis對(duì)該IP進(jìn)行封禁,這篇文章主要給大家介紹了關(guān)于Nginx利用Lua+Redis實(shí)現(xiàn)動(dòng)態(tài)封禁IP的相關(guān)資料,需要的朋友可以參考下
    2018-12-12
  • Nginx轉(zhuǎn)發(fā)404問(wèn)題的排查和思考

    Nginx轉(zhuǎn)發(fā)404問(wèn)題的排查和思考

    本篇文章原自當(dāng)前業(yè)務(wù)遇到的一個(gè)實(shí)際問(wèn)題,因?yàn)槭艿剿诰W(wǎng)絡(luò)環(huán)境的因素影響,所以整體排查下來(lái)耗費(fèi)了很大精力,記錄一下Nginx 轉(zhuǎn)發(fā) 404 問(wèn)題的排查和思考,需要的朋友可以參考下
    2023-09-09
  • Nginx-rewrite模塊概述

    Nginx-rewrite模塊概述

    從功能上看 rewrite 和 location 似乎有點(diǎn)像,都能實(shí)現(xiàn)跳轉(zhuǎn),主要區(qū)別在于 rewrite 是在同一域名內(nèi)更改獲取資源的路徑,這篇文章主要介紹了Nginx-rewrite模塊詳細(xì)介紹,需要的朋友可以參考下
    2023-06-06
  • nginx配置教程之a(chǎn)dd_header的坑詳解

    nginx配置教程之a(chǎn)dd_header的坑詳解

    這篇文章主要給大家介紹了關(guān)于nginx配置教程之a(chǎn)dd_header坑的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-02-02
  • nginx帶寬限制?limit_rate?limit_rate_after指令

    nginx帶寬限制?limit_rate?limit_rate_after指令

    這篇文章主要為大家介紹了nginx帶寬限制?limit_rate?limit_rate_after指令詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-04-04
  • Nginx 實(shí)現(xiàn)灰度發(fā)布的三種方法總結(jié)

    Nginx 實(shí)現(xiàn)灰度發(fā)布的三種方法總結(jié)

    這篇文章主要介紹了Nginx 實(shí)現(xiàn)灰度發(fā)布的三種方法總結(jié)的相關(guān)資料,需要的朋友可以參考下
    2017-05-05
  • Nginx的一些基本功能極速入門

    Nginx的一些基本功能極速入門

    本文主要介紹一些Nginx的最基本功能以及簡(jiǎn)單配置,但不包括Nginx的安裝部署以及實(shí)現(xiàn)原理。有興趣的可以了解一下。
    2016-12-12
  • nginx關(guān)閉/重啟/啟動(dòng)的操作方法

    nginx關(guān)閉/重啟/啟動(dòng)的操作方法

    在本篇文章里小編給各位分享的是關(guān)于nginx關(guān)閉/重啟/啟動(dòng)的操作方法,有興趣的朋友們可以學(xué)習(xí)參考下。
    2020-03-03
  • Nginx跨域訪問(wèn)場(chǎng)景配置和防盜鏈詳解

    Nginx跨域訪問(wèn)場(chǎng)景配置和防盜鏈詳解

    這篇文章主要介紹了Nginx跨域訪問(wèn)場(chǎng)景配置和防盜鏈詳解,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2019-07-07
  • Nginx配置PHP的Yii與CakePHP框架的rewrite規(guī)則示例

    Nginx配置PHP的Yii與CakePHP框架的rewrite規(guī)則示例

    這篇文章主要介紹了Nginx配置PHP的Yii與CakePHP框架的rewrite規(guī)則示例,是這兩款高人氣框架使用Nginx的關(guān)鍵配置點(diǎn),需要的朋友可以參考下
    2016-01-01

最新評(píng)論