Windows installation Nginx Detailed tutorial

Source: Internet
Author: User
Tags php tutorial

Windows installation Nginx Detailed tutorial

First step download Nginx, Windows version, decompression saved under C:/nginx (1.0.3 version)

The second step is to download the PHP tutorial fast-cgi version (I use VC9 x86 Non Thread Safe), extract to c:/php

The third step is to rename c:/php/php.ini-development into C:/php/php.ini, find #cgi.fix_pathinfo=1, and remove the # number.

Step Fourth Modify c:/nginx/conf/nginx.conf

Here's my simple configuration:


#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;
server_name localhost;

#charset Koi8-r;

#access_log Logs/host.access.log Main;

Location/{
#root html; The default path here
Root d:/public_html; Here for me to change the path to run the PHP program
Index index.php index.html index.htm; Increased the index.php
}

#error_page 404/404.html;

# REDIRECT Server error pages to the static page/50x.html
#
Error_page 502 503 504/50x.html;
Location =/50x.html {
root HTML;
}

# Proxy The PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ php$ {
# root PHP;
#index index.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 d:/public_html; Running the PHP program path
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php; Default Home Program
Fastcgi_param script_filename $document _root$fastcgi_script_name; $document _root refers to the d:/public_html above.
Include Fastcgi_params;

}

# Deny access to. 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 5m;

# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers all:! Adh:! Export56:rc4+rsa:+high:+medium:+low:+sslv2:+exp;
# ssl_prefer_server_ciphers on;

# location/{
# root HTML;
# index index.html index.htm;
#    }
#}

}

Step Fifth, PHP runs in fast-cgi form

Under CMD run below (the path may be somewhat different)

Step Sixth click Run Nginx.exe, run Nginx

Seventh step in the browser input localhost/index.php, run d:/public_html/index.php this program

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.