Win7下配置nginx和php5


本文鏈接:http://www.cnblogs.com/cnscoo/archive/2012/09/03/2668577.html

一、准備工作:

OS:Windows7 SP1

Nginx: nginx-1.3.5

php:php-5.4.6

二、解壓php-5.4.6-Win32-VC9-x86.zip到D:\php,將其中的php.ini-production改成php.ini。

三、解壓nginx-1.3.5.zip到D:\nginx,編輯D:\nginx\conf\nginx.conf文件:

        location / {
            root   html;
            index  index.html index.htm index.php; #添加PHP首頁
        }

  #取消以下注釋並修改:

        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;

       # html表示網站目錄,須和root中的保持一致
            fastcgi_param  SCRIPT_FILENAME  html$fastcgi_script_name;
            include        fastcgi_params;
        }

四、在D:\nginx中添加php-cgi.cmd文件並寫入內容:

"D:\php\php-cgi.exe" -b 127.0.0.1:9000 -c "D:\php\php.ini"

五、在D:\nginx\html文件夾中添加phpinfo文件index.php並寫入內容:

1 <?php
2     phpinfo();
3 ?>

六、運行D:\nginx\php-cgi.cmd和D:\nginx\nginx.exe,然后打開:http://localhost/index.php,有沒有看到熟悉的phpinfo頁面!

七、nginx基本命令:

  start nginx:啟動nginx

  nginx -s stop:停止nginx

  nginx -s quit:退出nginx


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM