Win+nginx+php+mysql the environment to build

Source: Internet
Author: User
Tags exit ini mysql download pack php file php download thread root directory

1. The WIN+NGINX+PHP+MYSQL Environment constructs

Nginx is a high-performance http and reverse proxy server, as well as a IMAP/POP3/SMTP proxy server, developed by the Russian rambler.ru site, Nginx is known for its stable performance and low system resource consumption. In recent years Nginx has become hot in the state, such as Tencent, NetEase, 51CTO, Thunder, Dangdang, 51, Renren and many other large sites have used Nginx to do the Web server, so learning Nginx is very necessary. June 1, 2011, Nginx 1.0.4 released.

1.1. Program Download

PHP Download: Enter PHP website download: http://windows.php.net/download/. Select the latest version "VC9 x86 Thread Safe (2011-mar-22 13:27:32)" (Figure 1), pop Up the Save dialog box and save it in the hard disk directory (Figure 2).

Figure 1

Figure 2

Non thread Safe: Non-thread. The opposite is the Thread safe.

Zip: Compressed package.

Installer: Install package.

Debug Pack: Debug Pack.

MySQL Download: access to MySQL website download: http://dev.mysql.com/downloads/mirror.php?id=402887. Select "No thanks,just Take Me to the downloads!" (Figure 3). Select the latest Mirror "Mysql-installer-5.5.13.0.msi" (Figure 4), Pop the Save dialog box and save it in the hard disk directory (Figure 5).

Figure 3

Figure 4

Figure 5

Nginx Download: Enter Nginx website download: http://nginx.org/en/download.html. Select the latest version of "nginx/windows-1.0.4 PGP" (Figure 6), pop Up the Save dialog box and save it in the hard disk directory (Figure 7).

Figure 6

Figure 7

1.2. Program Installation

In e-disk, create a new directory for DEDECMS, install the program all in this folder.

PHP configuration: In the Dedecms directory to create a new folder PHP5, compressed packets extracted to this directory, php.ini-production renamed to PHP.ini, with the editor to open this file (preferably not with Notepad), this file for the PHP configuration file.

Find positioning to:; Extension_dir = "./", remove the preceding semicolon and modify it to: Extension_dir = "E:dedecmsphp5ext"

Find positioning to: extension=php_gd2.dll, remove the preceding semicolon as: Extension=php_gd2.dll

Find positioning to: extension=php_mbstring.dll, remove the preceding semicolon as: Extension=php_mbstring.dll

Find positioning to: extension=php_mysql.dll, remove the preceding semicolon as: Extension=php_mysql.dll

Find positioning to: extension=php_mysqli.dll, remove the preceding semicolon as: Extension=php_mysqli.dll

Find positioning to: extension=php_pdo_mysql.dll, remove the preceding semicolon as: Extension=php_pdo_mysql.dll

Find positioning to: Cgi.force_redirect = 1, remove the preceding semicolon as: Cgi.force_redirect = 1

Find positioning to: cgi.fix_pathinfo=1, remove the preceding semicolon as: cgi.fix_pathinfo=1

Find positioning to: cgi.rfc2616_headers = 0, remove the preceding semicolon as: Cgi.rfc2616_headers = 1

MySQL Installation: Double-click the installation package into the installation environment interface, select "Install MySQL Products" (Figure 8).

Figure 8

Select "I Accept the License Terms" and select the "Next" button to continue the installation (Figure 9).

Figure 9

Select Skip the check for updates (not recommanded), and then select the Next button to continue the installation (Figure 10).

Figure 10

Select Custom to change the directory that was created before the installation path. Then select "Next" to continue the installation (Figure 11).

Figure 11

Choose "MySQL Server 5.5.13" and "MySQL Workbench 5.2.34", "MySQL Workbench 5.2.34" is a Visual database design tool. This tool is a dedicated tool for designing MySQL databases. You can also choose whether or not you want to install. Select the "Next" button to continue the installation (Figure 12).

Figure 12

Select the "Next" button to continue the installation (Figure 13).

Figure 13

Wait a moment. When the program is installed, select the "Next" button to configure the product (Figure 14).

Figure 14

Select "Server Machine" and select the "Next" button to continue (Figure 15).

Figure 15

Default 3306 port, default MySQL55 Windows service process name. Enter a password and a duplicate password. Select the "Next" button to continue (Figure 16).

Figure 16

The program is installed automatically, the installation is complete, and the "Next" screen appears (Figure 17).

Figure 17

Nginx configuration: Unzip all folders in the nginx-1.0.4 directory of the compressed package to the DEDECMS directory and open the nginx.conf configuration file in the Conf directory.

The 45th line should read: Index index.html index.htm index.php; Added PHP file support.

Line 65th to 71st should read:

Location ~. php$ {

root HTML;

Fastcgi_pass 127.0.0.1:9000;

Fastcgi_index index.php;

Fastcgi_param Script_filename E:/dedecms/html$fastcgi_script_name;

Include Fastcgi_params;

}

E:/dedecms/html is the root directory of the Web site. This directory can also be reconfigured. Find code:

Location/{
root HTML;
Index index.html index.htm index.php;
}

of which root HTML; is the site root directory, such as can be changed to: Root wwwroot;

1.3. Startup and shutdown of services

Set up two files to start and close the service process separately.

Create a file in Dedecms Start_nginx.bat

@echo off

echo Starting PHP FastCGI ...

Runhiddenconsole e:/dedecms/php5/php-cgi.exe-b 127.0.0.1:9000-c E:/dedecms/php5/php.ini

Echo Starting Nginx ...

Runhiddenconsole E:/dedecms/nginx.exe

Exit

Create a file in Dedecms Stop_nginx.bat

@echo off

echo Stopping Nginx ...

taskkill/f/im nginx.exe > nul

echo Stopping PHP FastCGI ...

taskkill/f/im php-cgi.exe > nul

Exit

Download software: Http://www.haoboweb.com/uploads/allimg/110613/RunHiddenConsole.zip. (only upload pictures, not software)

Unzip to the Dedecms directory, double-click Start_nginx.bat to start the service process (Figure 18). This shows that the Stop_nginx.bat file is shutting down the service process.

Figure 18

1.4. Environmental testing

Create a index.php file in the root directory of the Web site, which reads:

<title>welcome to Nginx!</title>

<body>

<?php

$link = mysql_connect ("localhost", "root", "123456");

if ($link) {

echo " Database Connection Successful! ";

}else{

echo " Database connection Failed! ";

}

?>

</body>

Output "Database connection successful!" , Nginx's PHP environment was configured successfully (Figure 19).

Figure 19

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.