Windows under the Nginx+php+eclipse development environment built.

Source: Internet
Author: User

Reference to the original http://www.cnblogs.com/huayangmeng/archive/2011/06/15/2081337.html

1, first need to prepare the application package.

nginx:nginx/windows-1.1.3

Php:php-5.2.16-nts-win32-vc9-x86.zip (Nginx PHP is run in fastcgi mode, so we download the PHP package that is not thread safe or NTS) MSI installation package

RunHiddenConsole:RunHiddenConsole.zip

2, installation and configuration.

1 installation and configuration of PHP.

Directly unzip the download good PHP package to install my installation directory for the G disk PHP directory (G:\PHP), into the folder to modify the php.ini-recommended file for php.ini, and EditPlus or notepad++ to open it. Found it

Extension_dir = "./ext"

Change to

Extension_dir = "G:/php/ext" Next we'll configure PHP so that PHP can be combined with nginx. Found it

Cgi.fix_pathinfo = 1 2) Nginx installation and configuration.

The download of the nginx-1.1.3 package is also extracted to the G-Disk we configure the Nginx, so that it can work in conjunction with PHP. Enter Nginx's conf directory, open nginx configuration file nginx.conf, find

Location/{root HTML; #这里是站点的根目录 index index.html index.htm; }

Change root HTML to root g:/www;

Go down and find

#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 remove the "#" in front of it, and also change the root HTML to root g:/www; Then the marked red/scripts changed to "$document _root", where the "$document _root" refers to the previous "root" refers to the site path, which is changed after:

# Pass the PHP scripts to FastCGI server listening on 127.0. 0.1:9000 # location ~. PHP $ {root g:/www; fastcgi_pass 127.0.0.1:9000 fastcgi_index index. PHP fastcgi_param script_filename $document _roo T $ fastcgi_script_name; Include Fastcgi_params; }

Save the configuration file and it's OK.

Enter the command line directory to switch to g:/php to execute the following command:

Php-cgi.exe-b 127.0.0.1:9000-c G:/php/php.ini

To start PHP, and manually start Nginx, of course, you can also use the script to implement

First of all, the download of the Runhiddenconsole.zip package into the Nginx directory, RunHiddenConsole.exe is the role of the command line after the execution of the script can automatically close the script, and the process opened from the script is not closed. Then to create the script, named "Start_nginx.bat," we'll edit it in notepad++.

@echo off
Invalid under REM Windows
REM Set php_fcgi_children=5

REM the maximum number of requests processed per process, or set as Windows environment variable
Set php_fcgi_max_requests=1000

echo Starting PHP FastCGI ...
Runhiddenconsole g:/php/php-cgi.exe-b 127.0.0.1:9000-c G:/php/php.ini

Echo Starting Nginx ...
Runhiddenconsole g:/nginx-1.3.11/nginx-1.3.11/nginx.exe-p g:/nginx-1.3.11/nginx-1.3.11

Then create a close Nginx script that 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

To do well is this:

In this way, our service scripts are also created. Double-click Start_nginx.bat to see if the process manager has two nginx.exe processes and a php-cgi.exe process.

The Nginx service starts, and PHP runs in a fastcgi way.

To the Site directory, create a new 1.php file, edit it inside

? PHP phpinfo ();?>

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

Then download the Spring Tools suite (Spring based eclipse version) or Eclipse for Java version

Click Help to select the figure:

Click the arrow at the Ecipse marktplace see the following figure in the search box to enter PHP and then you will see

Windows Azure Toolkit for Eclipse

As shown in figure:

Select Install then install the prompts all the way, and finally restart the STS or Eclipse machine. This allows you to create PHP Project. It's OK to put the working directory of your project in the G:/www directory.

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.