nginx简介及简单使用

时间:2021-08-07 16:39:44

Nginx is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. Igor Sysoev started development of Nginx in 2002, with the first public release in 2004. Nginx now hosts nearly 12.18% (22.2M) of all domains worldwide. As Netcraft predicted, Nginx now surpasses Microsoft IIS as the second most popular web server.

Nginx is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption.

Nginx is one of a handful of servers written to address the C10K problem. Unlike traditional servers, Nginx doesn't rely on threads to handle requests. Instead it uses a much more scalable event-driven (asynchronous) architecture. This architecture uses small, but more importantly, predictable amounts of memory under load.
Even if you don't expect to handle thousands of simultaneous requests, you can still benefit from Nginx's high-performance and small memory footprint. Nginx scales in all directions: from the smallest VPS all the way up to clusters of servers.

Nginx powers several high-visibility sites, such as WordPressHuluGithubOhlohSourceForgeWhitePages and TorrentReactor.


下面开始介绍下nginx的下载、安装及简单使用:

1、下载:

2011年4月12日 nginx 最新Windows版程序下载地址:

http://nginx.org/download/nginx-1.0.0.zip

2、安装:

使用上面的下载地址下载得到一ZIP压缩包,解压得到nginx-1.0.0文件夹。

例如解压到D:\nginx\

3、简单使用:

首先编辑nginx文件夹内conf文件夹里的nginx.conf,修改端口:

例如可修改 listen       8080 ,即为设置默认访问端口为8080.

然后在CMD(命令提示符)中切换工作目录到D:\nginx

接着输入:start nginx ,并回车。

如果防火墙弹出提示,请允许通过。

接下来打开浏览器,访问http://127.0.0.1:8080,

如果页面显示“Welcome to nginx!”,那就运行成功了。

这个页面在nginx的html目录下。

更高级的功能配置请参考nginx官方WIKI:http://wiki.nginx.org/

nginx中文WIKI:http://wiki.nginx.org/NginxChs