搭建wordpress開發環境

安裝php

PHP下載地址:http://windows.php.net/download/php

08.download_php

和MySQL同樣,下載包是一個zip壓縮包,只需解壓縮便可。將它解壓縮到 D:\WNMP\php-5.5.6-Win32-VC11-x64目錄下:html

09.install_php

配置php

將php.ini-production文件複製並重命名爲php.ini,並用Notepad++(沒有安裝此軟件的話就使用記事本)打開php.ini:mysql

查找並定位到行 修改成
; extension_dir = 「ext」 extension_dir = 「ext」
;extension=php_gd2.dll extension=php_gd2.dll
;extension=php_mbstring.dll extension=php_mbstring.dll
;extension=php_mysql.dll extension=php_mysql.dll
;extension=php_mysqli.dll extension=php_mysqli.dll
;extension=php_pdo_mysql.dll extension=php_pdo_mysql.dll
;cgi.force_redirect = 1 cgi.force_redirect = 1
;cgi.fix_pathinfo=1 cgi.fix_pathinfo=1
;cgi.rfc2616_headers = 0 cgi.rfc2616_headers = 1

安裝MySQL

請閱讀我寫的文章《在Windows7_x64下安裝MySQL(zip壓縮包)nginx

安裝Nginx

Nginx下載地址:http://nginx.org/en/download.htmlweb

10.download_nginx

當前能夠選擇下載穩定版本1.4.3,或者選擇最新版本1.5.6,本文選擇下載最新版。與php和mysql同樣,下載包是一個zip壓縮包,將它解壓縮到D:\WNMP\nginx-1.5.6目錄下:sql

11.install_nginx

配置Nginx

Nginx的配置文件是在安裝目錄的conf文件夾下的nginx.conf,並用Notepad++(沒有安裝此軟件的話就使用記事本)打開它:shell

查找並定位到如下配置:數據庫

1
2
3
4
      location / {
          root   html;
          index  index.html index.htm;
      }

修改成:windows

1
2
3
4
      location / {
          root   html;
          index  index.html index.htm index.php;
      }

繼續往下查找並定位到如下配置:瀏覽器

1
2
3
4
5
6
7
      #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;
      #}

將#號去掉,並改成:

1
2
3
4
5
6
7
      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;
      }

在Nginx的根目錄下

建立php-cgi-start.vbs文件,添加如下內容:

1
createobject ( "wscript.shell" ) .run "D:\WNMP\php-5.5.6-Win32-VC11-x64\php-cgi.exe -b 127.0.0.1:9000 -c D:\WNMP\php-5.5.6-Win32-VC11-x64\php.ini" , 0

建立nginx-start.vbs文件,添加如下內容:

1
createobject("wscript.shell").run "D:\WNMP\nginx-1.5.6\nginx.exe",0

建立service-start.bat文件用於啓動web服務器,添加如下內容:

1
2
3
4
5
6
echo off;
php-cgi-start.vbs
echo php-cgi started.
Nginx-start.vbs
echo nginx started.
exit;

建立service-stop.bat文件用於關閉web服務器,添加如下內容:

1
2
3
4
5
6
echo off
echo Stopping nginx...
taskkill /F /IM nginx.exe > nul
echo Stopping PHP FastCGI...
taskkill /F /IM php-cgi.exe > nul
exit

之後只需用鼠標雙擊service-start.bat啓動web服務,運行service-stop.bat關閉web服務。

配置完成後Nginx的安裝根目錄以下:

12.install.nginx

安裝wordpress

將wordpress壓縮包解壓到D:\WNMP\nginx-1.5.6\html\目錄下(這個目錄是咱們已配置的nginx默認根目錄),並將文件夾重命名爲wp,以下:

13.install_wordpress

鏈接mysql數據庫建立一個由wordpress專用的數據庫:

C:\Windows\System32>mysql -h localhost -u root -p123456
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.25-log MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database wordpress;
Query OK, 1 row affected (0.00 sec)

mysql> create user wp_admin@localhost identified by '123456';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on wordpress.* to wp_admin;
Query OK, 0 rows affected (0.00 sec)

在瀏覽器訪問:http://localhost/wp便可訪問wordpress安裝頁面(注意:nginx已啓動)

14.install_wordpress

建立配置文件

15.install_wordpress

如今就開始

16.install_wordpress

提交

17.install_wordpress

進行安裝

接下去就跟普通的網上註冊同樣簡單了。

18.install_wordpress

相關文章
相關標籤/搜索