windows nginx +php 配備

來源:互聯網
上載者:User
windows nginx +php 配置

在windows下進行nginx +php的配置比較簡單:

1、首先下載安裝php,版本至少要在5.0以上(主要是要PHP版本支援FastCgi方式,包含有php-cgi.exe即可),修改php.ini設定檔

enable_dl = On
cgi.force_redirect = 0
cgi.fix_pathinfo=1
fastcgi.impersonate = 1
cgi.rfc2616_headers = 1

rror_reporting = E_ALL
display_errors = On
extension_dir = "C:\php\ext"
; 動態擴充,可以根據需要去掉 extension 前面的注釋 ;?
; 如載入 PDO, MySQL
extension=php_pdo.dll
extension=php_pdo_mysql.dll

2、Nginx配置PHP是以FastCgi方式配置的

3、用文本編輯功能根據開啟E:\nginx1.0\conf 目錄下的nginx.conf,找到

?

?

?? ? ? ?location / {

?? ? ? ? ? ?root ??html;

?? ? ? ? ? ?index ?index.html index.htm;

?? ? ? ?}

修改為

?

?

?? ? ? ?location / {

?? ? ? ? ? ?root ??D:/PHPWeb;

?? ? ? ? ? ?index ?index.php index.html index.htm;

?? ? ? ?}

找到

?

# 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;

?? ? ? ?#}

修改為

?

# 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? D:/PHPWeb$fastcgi_script_name;

?? ? ? ? ? ?include ? ? ? ?fastcgi_params;

?? ? ? ?}

4、啟動fast-cgi

?找到php的安裝目錄,在控制台輸入以下命令

f:/php/php-cgi.exe -b 127.0.0.1:9000 -c f:/php/php.ini

5、找到nginx的安裝目錄,啟動nginx

或者建立batlogin"> 您還沒有登入,請您登入後再發表評論

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.