windows 下安裝 nginx + php

來源:互聯網
上載者:User

標籤:file   class   host   lan   解壓   stop   不能   命令   www   

1. 下載軟體

  需要的軟體有nginx,php,mysql(如不需要可不安裝)
  nginx.org,www.php.net上面有得下
  全部解壓出來
  php基本不用做任何修改(下載直接解壓版本的)

  用cmd命令在nginx 目錄執行 start nginx.exe 就可以啟動 nginx ,注意80連接埠是否被佔用,啟動成功 在瀏覽器運行 localhost 就可以開啟nginx 預設頁面

  

但是,現在還不能運行php檔案,需要進行配置,繼續

2. 配置 nginx

  在nginx.conf 檔案找到以下被注釋的代碼,修改root為絕對路徑,並設定SCRIPT_FILENAME 後面的用$document_root 替代

 

  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
    root E:/PHPTools/nginx-1.13.4/html;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
    include fastcgi_params;
  }

 

3. 運行軟體

  cmd 命令在php安裝目錄執行 start php-cgi.exe -b 127.0.0.1:9000 -c php.ini

  cmd 命令在nginx 安裝目錄執行nginx.exe -s stop 先把剛才啟動的nginx進程關掉,然後重新啟動 start nginx.exe

  到此,nginx + php 配置完成。再安裝mysql就可以進行開發了。

 

 

參考文獻:http://www.nginx.cn/doc/setup/nginx-windows.html

windows 下安裝 nginx + php

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.