Install and configure the Nginx + php + mysql environment on the win platform. nginxmysql_PHP tutorial

Source: Internet
Author: User
Tags vps server
Install and configure Nginx + php + mysql on win platform, and nginxmysql. Install and configure the Nginx + php + mysql environment on the win platform, and prepare for nginxmysql1. (1) PHP 5.6.17PHP official website (2) nginx version 1.8.0Nginx official win platform installation and configuration Nginx + php + mysql environment, nginxmysql

1. preparations

(1) PHP 5.6.17 PHP official website

(2) Nginx version 1.8.0 Nginx official website

(3) MySQL 5.7.10 MySQL official website

2. install and configure php

Directly decompress the downloaded php package to the wnmp Directory (D: \ wnmp) on the D drive. here, rename the decompressed folder to php5. Go to the folder and modify the php. ini-delelopment file to php. ini, and open it with Editplus or Notepad ++. Find

Extension_dir = "ext" changed to extension_dir = "D:/wnmp/php5/ext"

Common extensions, remove the previous ";"

  extension=php_curl.dll  extension=php_gd2.dll  extension=php_mbstring.dll  extension=php_mcrypt.dll  extension=php_mysql.dll  extension=php_mysqli.dll  extension=php_pdo.dll  extension=php_pdo_mysql.dll  extension=php_xmlrpc.dll

Nginx supports configuration. remove the preceding ";"

; Cgi. fix_pathinfo = 1

; Cgi. force_redirect = 1

; Cgi. rfc2616_headers = 0 first go to the front semicolon and then change to cgi. rfc2616_headers = 1

3. install and configure Nginx

Decompress the downloaded package to D: \ wnmpand directly run nginx.exe in the directory to start.

1. there are three startup methods

(1)double-click the nginx.exe icon. the black window flashed through and started.

(2) run the command line to the nginx directory and enter nginx to start. (Note: the command line window in this mode has no prompt and is locked)

(3) run the command line to the nginx directory and enter start nginx to start. this mode is not locked.

2. support for PHP configuration modification

Go to the nginx conf Directory, open the nginx configuration file nginx. conf, and find

Location/{root html; # Here is the site's root directory index index.html index.htm index. php ;}

Change root html; to root D:/wnmp/www;

Next, find

    # pass the PHP scripts to FastCGI serverlistening on    #    #location ~ \.php$ {    #  root      html;    #  fastcgi_pass;    #  fastcgi_index index.php;    #  fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;    #  include    fastcgi_params;    #}

First remove "#" and change root html; to root D:/wnmp/www ;. Change the/scripts marked in red to "$ document_root". here, "$ document_root" refers to the site path referred to by "root". this is changed:

    # pass the PHP scripts to FastCGI serverlistening on    #    location ~ \.php$ {        root      D:/wnmp/www;       fastcgi_pass;       fastcgi_index index.php;       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;       include    fastcgi_params;    }

Save the configuration file.

The nginx + php environment has been initially configured. We can enter the command

To start php and manually start nginx. of course, you can also use the script.

First, decompress the downloaded runhiddenconsole.zippackage to the nginxdirectory. runhiddenconsole.exe automatically closes the script after executing the command script, but the processes enabled from the script are not disabled. Create a script named "start_nginx.bat ".

@ Echooff
Invalid REMWindows

REM the maximum number of requests processed by each process, or set it to a Windows environment variable

Echo Starting PHPFastCGI...
RunHiddenConsole D:/wnmp/php5/php-cgi.exe-B 9000-cD:/wnmp/php5/php. ini

Echo Starting nginx...
RunHiddenConsole D:/wnmp/nginx/nginx.exe-p D:/wnmp/nginx

Create another script named stop_nginx.bat to disable nginx.

@echooffecho Stoppingnginx... taskkill /F /IM nginx.exe > nulecho Stopping PHPFastCGI...taskkill /F /IM php-cgi.exe > nulexit

In this way, all our service scripts have been created. Double-click start_nginx.batto check whether the process manager has two nginx.exepaths and a php-cgi.exe process?

In this way, the nginx service is started and php runs in fastCGI mode.

Go to the site directory, create a phpinfo. php file, and edit it in it.

  <?php echo phpinfo();?>

After saving, open the browser and enter "http: // localhost/phpinfo. php". if you see

The nginx + php environment has been configured ~

4. install and configure MySQL

(Simple) install and download MySQL, one way to install next.

Articles you may be interested in:
  • Nginx + PHP + MySQL dual-host mutual backup, full automatic switch solution
  • Nginx 0.7.x + PHP 5.2.6 (FastCGI) + MySQL 5.1 Configuration Optimization on m small memory VPS server
  • Use nginx for website load balancing test instances in windows
  • Installation and configuration of Nginx and PHP5 in Windows
  • Detailed configuration of CentOS + Nginx + PHP + MySQL (illustration)
  • How to Configure Nginx + Windows server load balancer
  • How to Configure nginx to enable phpinfo mode in linux (centos5.5)/windows
  • Install and configure the LNMP server in CentOS 6.4 (Nginx + PHP + MySQL)
  • Diagram of deployment steps for installing nginx in windows (reverse proxy and server load balancer)

Prepare environment, nginxmysql 1. preparations (1) PHP version 5.6.17 PHP official website helper House (2) Nginx version 1.8.0 Nginx official website...

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: 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.