1024programmer Nginx Install and use Nginx under Windows2003 system

Install and use Nginx under Windows2003 system

nginx can really exert its good load capacity under linux.

We set up a good environment under windows to test, develop and use. It is strongly recommended to develop under linux.

—-

download nginx

Visit www.nginx.org, download the latest development version: 1.1.5 (it seems that nginx will also show signs of developing towards version emperor)

File name: nginx-1.1.5.zip

Create an nginx directory on the hard disk and unzip it.

There is only one nginx.exe file in the directory, and the total size does not exceed 2.15M, which is really slim.

If you just want to do html parsing, just run nginx.exe directly. The default web directory is nginx\html, and we generally need to configure it to support php, haha.

nginx+php+FastCGI

Here using the latest version of php 5.3.8 (as of October 14, 2011)

Download php, visit www.php.net, select the windows version of php to download, download non-thread-safe or thread-safe, here pay attention:

What is Non Thread Safe?
Non Thread Safe is non-thread safe;
What is Thread Safe?
Non Thread Safe is thread safe;
The official does not recommend that you apply Non Thread Safe to the production environment, so we choose the Thread Safe version of PHP to use

We use the non-thread-safe version here. Unzip php-5.3.8-nts-Win32-VC9-x86.zip to the hard disk directory, such as d:\php

Let’s start configuration… The key is configuration, hey, now is an era of configuration…

The nginx configuration file is in the conf directory under the nginx directory, named nginx.conf

I will not talk about the specific configuration, only the configuration for php.

In the server { … } section, find the listen and
server_name, configured as follows (if the port is to be set to 80, please ensure that no other application servers, such as IIS, apache, etc. are installed, or that they are not running):

server {
listen 80;
“ server_name`
localhost:80;

By the way, also change the code:

charset
utf-8;

Then: the location section is also changed:

location / {
#Set the default homepage file of the website
index index.html index.htm index.php;
#Set the root directory of the website
root d:/nginx/html/;
    }  

Then it is related to php, using fastcgi:

Find #pass the PHP scripts to FastCGI server listening on
127.0.0.1:9000 This line, the following reference:

d:/nginx/html/$fastcgi_script_name;
include
fastcgi_params;
}

Save, and then make a bat file for nginx.exe, the content is as follows:

@echo off
REM “Starting Nginx server…..”

start nginx

REM “starting PHP FastCGI…”

start D:\php\php-cgi.exe -b 127.0.0.1:9000

Ok, next configure php, open the php directory, rename the php. ok)

Open it with a text editor, I use PsPad, free powerful text editor.

Add (these configuration items are actually commented out, you can search and remove the previous “;”):

fastcgi.impersOnate= 1
cgi.fix_pathinfo=1
cgi.force_redirect = 0

Generally, this is the end, but php itself still needs to be configured, refer to:

memory_limit = 256M

default_charset = “utf-8”

user_dir=”d:\ningx\html”

extension_dir = “d:\php\ext”

Remove such as extension=php_mysql.dll or
extension=php_mysqli.dll The comment symbol “;” in front of these extensions

Let others look at it.

Save, in the html directory of the nginx directory, create an index.php file, the content of which is as follows:

<?php
phpinfo();
?>

Then double-click the batch file built above, and then enter in the browser: http://localhost/index.php

Finish!

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/install-and-use-nginx-under-windows2003-system/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索