ThinkPHP learning (1) install and configure Nginx + PHP5 + ThinkPHP_3.2.1 in Windows

Source: Internet
Author: User
Tags vc9
ThinkPHP (1) install and configure Nginx + PHP5 + ThinkPHP_3.2.1 in Windows. raw materials: Nginx153: network disk: pan. baidu. coms1qWNgLf2php-5.3.28-nts-Win32-VC9-x86 network disk: pan. baidu. coms1pdukYThinkPHP _ ThinkPHP learning (1) install and configure Nginx + PHP5 + ThinkPHP_3.2.1 in Windows
Tool raw materials:

Nginx153:

Network Disk: http://pan.baidu.com/s/1qWNgLf2

Php-5.3.28-nts-Win32-VC9-x86

Network Disk: http://pan.baidu.com/s/1pdukY

ThinkPHP_3.2.1

Network Disk: http://pan.baidu.com/s/1pJlpfuj

RunHiddenConsole is a small program used to hide DOS windows.

Network Disk: http://pan.baidu.com/s/1gd7kApP

To start installation, decompress the file:

Decompress Nginx to "F: \ Nginx153 ";


Decompress RunHiddenConsole to "F: \ Nginx153 ";

Decompress PHP5 to "F: \ PHP \ php5328Win32 ";


Decompress ThinkPHP to "F: \ PHP ";


Modify the PHP configuration file

Modify the file name "PHP. ini-development" in the "F: \ php \ php5328Win32" directory and remove "-development". the file content is not modified.

Modify Nginx configuration file

In a text editor, I use Notepad ++ to open the "Nginx. conf" file under the "F: \ Nginx153 \ conf" directory,

The content of the configuration file is as follows. the key points are briefly annotated in Chinese:

# User nobody; worker_processes 1; # error_log logs/error. log; # error_log logs/error. log notice; # error_log logs/error. log info; # pid logs/nginx. pid; events {worker_connections 1024;} http {include mime. types; default_type application/octet-stream; # log_format main '$ remote_addr-$ remote_user [$ time_local] "$ request"' # '$ status $ body_bytes_sent "$ http_referer"' # '"$ http_user_agent" "$ http_x_forwarded _ For "'; # access_log logs/access. log main; sendfile on; # tcp_nopush on; # keepalive_timeout 0; keepalive_timeout 65; # gzip on; server {listen 80; # // port number server_name localhost; # // domain name, host header value # charset KOI8-R; # access_log logs/host. access. log main; location/{root F: \ www \ html; # // index index.html index.htm index of the site root directory. php; # // response page} # error_page 404/404 .html; # redirect server error pages to the stati C page/50x.html # error_page 500 502 503 x.html; location =/50x.html {root html;} # proxy the PHP scripts to Apache listening on 127.0.0.1: 80 # location ~ \. Php $ {# proxy_pass http://127.0.0.1 #}# Pass the PHP scripts to FastCGI server listening on 127.0.0.1: 9000 ## location ~ \. Php $ {# root F: \ PHP; # fastcgi_pass 127.0.0.1: 9000; # fastcgi_index index. php; # fastcgi_param SCRIPT_FILENAME/scripts $ fastcgi_script_name; # include fastcgi_params; #}# ThinkPHP configure location ~. *\. Php. * {root F: \ PHP; # // location of the ThinkPHP framework file fastcgi_pass127.0.0.1: 9000; fastcgi_indexindex.php; includefastcgi. conf; set $ real_script_name $ fastcgi_script_name; parameters $ document_root $ fastcgi_script_name; fastcgi_paramSCRIPT_NAME $ real_script_name; parameters $ path_info; if ($ fastcgi_script_name ~ "^ (. +? \. Php )(/. +) $ ") {set $ real_script_name $1; set $ path_info $2 ;}# deny access. htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\. Ht {# deny all ;#}# another virtual host using mix of IP-, name-, and port-based configuration # server {# listen 8000; # listen somename: 8080; # server_name somename alias another. alias; # location/{# root html; # index index.html index.htm; #}#}# HTTPS server # server {# listen 443; # server_name localhost; # ssl on; # ssl_certificate cert. pem; # ssl_certificate_key cert. key ;# Ssl_session_timeout 5 m; # ssl_protocols SSLv2 SSLv3 TLSv1; # ssl_ciphers HIGH :! ANULL :! MD5; # ssl_prefer_server_ciphers on; # location/{# root html; # index index.html index.htm ;#}#}}

Create a service batch start (. bat) file named "start_nginx.bat". the file content is as follows:

@echo offecho Starting PHP FastCGI...RunHiddenConsole ../php/php5328Win32/php-cgi.exe -b 127.0.0.1:9000 -c ../php/php5328Win32/php.iniecho Starting nginx...nginx.exepause

Create a Stop Service batch processing (. bat) file named "stop_nginx.bat". the file content is as follows:
@echo offecho Stopping nginx...taskkill /F /IM nginx.exe > nulecho Stopping PHP FastCGI...taskkill /F /IM php-cgi.exe > nulexit
Witness a miracle:

Double-click start_nginx.bat to start the service. a DOS window is opened, which can be minimized or closed;

Open your browser, enter "http: // localhost/index. php" in the address bar, and press Enter. can you see a few big words?

Welcome to ThinkPHP!

Congratulations, environment configuration is successful!





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.