2015年9月17日 星期四

enable nginx HTTPS

無法查看此摘要。請 按這裡查看文章。

[Windows] 自己打造免安裝版的WNMP - Nginx+PHP5+MariaDB

安裝前須知
VC9 與 VC11(原文請請參考http://windows.php.net/download/)
使用 VC9 版本時,需安裝 Visual C++ Redistributable for Visual Studio 2008 SP1 x86 or x64
使用 VC11 版本時,需安裝 Visual C++ Redistributable for Visual Studio 2012 x86 or x64
註:x86 表示 32位元版本,x64 表示 64位元版本。
因為 Windows XP 與 Windows 2003請使用PHP5.4.X以前版本,因為我的作業系統為win10 所以使用PHP5.5.X以後版本這裡是用PHP5.6.9

下載 WNMP-Lite-Win32-VC9-portable.7z 解壓縮至 E:\ (也可解壓縮至 C:\)。解壓縮後大約42M,因為PHP、MariaDB經過瘦身,有完整版需求者請自行至相關官網下載,覆蓋檔案即可。這裡是用PHP5.6.9取代,MariaDB5.5.36取代。

此版本已設定使用者目錄(UserDir),欲安裝 WordPress 參考 http://web.dhjh.tc.edu.tw/~gzqbyr/fluxbb/forums/viewtopic.php?id=382
執行 E:\WNMP\start.bat 即可啟動網頁伺服器,而執行 E:\WNMP\stop.bat 可停止伺服器。

adminer.php
可以在https://www.adminer.org/取得最新版本,這裡是用Adminer 4.2.2。
瀏覽 127.0.0.1/adminer.php,帳號 輸入 root ⇨ 登入。













開始製作可擕式 WNMP
建立 E:\WNMP 資料夾。
Nginx 安裝:
http://nginx.org/en/download.html 下載 nginx-1.8.x(x 表示版本號),解壓縮至 E:\WNMP。將 E:\WNMP\nginx-1.8.0 重新命名為 E:\WNMP\nginx。
編輯 nginx\conf\nginx.conf
尋找
       location / {
            root   html;
            index  index.html index.htm;
        }
取代為
       location / {
            root   html;
            index  index.php index.html index.htm;
        }

  location ~ .*\.php(\/.*)*$ {
   root html;
   fastcgi_pass   127.0.0.1:9000;
   fastcgi_index  index.php;
   fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
   include fastcgi_params;
  }

PHP 安裝:
建立資料夾 E:\WNMP\php。
http://windows.php.net/downloads/releases/archives/  下載 php-5.5.x-Win32-VC9-x86.zip(x 表示版本號),解壓縮至 E:\WNMP\php。(僅php5.2才能使用SQLite2)
重新命名 E:\WNMP\php\php.ini-development 為 php.ini
編輯 E:\WNMP\php\php.ini(不同的PHP版本的 extension 設定也稍微不一樣)
尋找
extension_dir = "ext"
取代為
extension_dir = "./ext/"
尋找
;extension=php_gd2.dll
;extension=php_mbstring.dll
;extension=php_mysql.dll
;extension=php_mysqli.dll
;extension=php_pdo_mysql.dll
;extension=php_pdo_sqlite.dll
;extension=php_sqlite3.dll

取消註解 ;。

MariaDB 安裝:(以MariaDB取代MySQL)
MariaDB 官網 - https://mariadb.org/
以 MariaDB-5.5.36 為例。
https://downloads.mariadb.org/mariadb/5.5.36/ 下載 mariadb-5.5.36-win32.zip,解壓縮至 E:\WNMP。
至 E:\WNMP 將 資料夾 mariadb-5.5.36-win32 更名為 mariadb
下載 NirCmd,解壓縮後將 nircmd.exe 複製至 D:\WNMP。
將 restart.bat、start.bat、stop.bat 存至 D:\WNMP。


然後在DOS模式下(系統管理員)啟動 restart.bat