Windows 2008 Configuration Nginx+php+mysql Environment steps

Source: Internet
Author: User
Tags ini md5 php and phpinfo win32 mysql database

This tutorial is primarily configured with the Windows 2008 SP2 32bit standard to configure PHP 7.0rc2+nginx 1.9.4+mysql 5.6.26, and to turn on HTTPS access.

First, preparatory work

1, Nginx+php+mysql and other downloads and decompression: Baidu Network disk
2, the above software may use VC + + Run library Download: Baidu Network disk

Second, streamline and install MySQL

1, decompression mysql-5.6.26-win32.zip to D:\mysql-5.6.26-win32, and rename My-default.ini for My.ini
2. Delete docs, include, mysql-test, scripts, and Sql-bench folders, as well as copying and readme files, delete the PDB suffix name files in the remaining folders
3, simple configuration under My.ini, modified as follows:

# Basedir =

... # DataDir =

... Modified to:

Basedir = "D:\mysql-5.6.26-win32"

datadir = "D:\mysql-5.6.26-win32\data"


4, add MySQL service


The cmd command is as follows:

D:\mysql-5.6.26-win32\bin>mysqld-install mysql--defaults-file= "D:\mysql-5.6.26-win32\my.ini"

d:\ Mysql-5.6.26-win32\bin>net start MySQL If you need to turn off the service, cmd command to enter "net stop MySQL" (do not enter double quotes)


If you need to uninstall the service, cmd command enter "SC delete MySQL" (do not enter double quotes)

Second, the installation of PHP

1, decompression php-7.0.0rc2-nts-win32-vc14-x86.zip to D:\PHP and rename php.ini-production for php.ini
2. Modify PHP.ini


Line No. 725; Extension_dir = "ext" First go to the previous semicolon and then to Extension_dir = "D:\php\ext"
Line No. 735 enable_dl = off to Enable_dl = On
Line No. 742; cgi.force_redirect = 1 First go to the previous semicolon and then to Cgi.force_redirect = 0
Line No. 770; fastcgi.impersonate = 1 Remove the preceding semicolon
Line No. 782; cgi.rfc2616_headers = 0 first go to the previous semicolon and then to Cgi.rfc2616_headers = 1
No. 879, 883 lines, remove the front of the ";" Extension=php_mysqli.dll and Extension=php_pdo_mysql.dll (MySQL database support)


3, can remove extension= front of ";" Open the appropriate extension

Iii. installation of Nginx

1, decompression nginx-1.9.4 to D:\nginx-1.9.4 and modify D:\nginx-1.9.4\conf\nginx.conf
2, modify the nginx.conf as follows:

Modify 65-71 lines          #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;         #} First "#" to remove, and then "/scripts" to "$document _root", where the "$document _root
"refers to the previous" root "refers to the site path, which is after the change:         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;         }


Four, bat one key operation

1, one key operation; extract Runhiddenconsole to D and save the following code as Start.bat

@echo off

Echo starting PHP FastCGI

... D:\RunHiddenConsole.exe D:\PHP\php-cgi.exe-b 127.0.0.1:9000-c D:\PHP\php.ini

echo starting nginx ...

D:\RunHiddenConsole.exe D:\nginx-1.9.4\nginx.exe-p D:\nginx-1.9.4

echo starting mysql ...


2, a piece of end; Save the following code as Stop.bat

@echo off

echo stopping Nginx

... taskkill/f/im nginx.exe > Nul

echo stopping PHP FastCGI ...

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

exit


3, Phpinfo output information



Five, open HTTPS access

1, SLL free certificate can go to Wellec application, Vauton Free Application address
2, my Side application is good, the for nginx.zip extract to D:\nginx-1.9.4\conf
3. Modify D:\nginx-1.9.4\conf\nginx.conf File


Modify 98-115 lines:

     #server  {    #    listen  
     443 ssl;
    #    server_name  localhost;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;
    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;     #    ssl_ciphers  high:!anull:!
MD5;
    #    ssl_prefer_server_ciphers  on;     #    location / {    #  
      root   html;     #        index  index.html index.htm;     #   &NBSP}     #} removes the # before each line and adds  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;         }

After the revision is complete as follows:

   server {        listen    
   443 ssl;
        server_name  localhost;         ssl_certificate      1_
WWW.MYXZY.COM_BUNDLE.CRT;
        ssl_certificate_key  2_www.myxzy.com.key;
    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;     #    ssl_ciphers  high:!anull:!
MD5;
    #    ssl_prefer_server_ciphers  on;         location / {      
      root   html;  &nbSp;          index  index.php index.html
 index.htm;        &NBSP}  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;         }     }

4, HTTPS phpinfo output information (domain name local host to test)

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.