Nginx (same as engine X) is a lightweight Web server/reverse proxy server and email (IMAP/POP3) proxy server, which is released under a BSD-like protocol. By RussiaProgramDeveloped by the designer Igor Sysoev, it was initially used by a large Russian portal website and search engine Rambler (RUSSIAN: Russian simplified traditional search. It is characterized by a small amount of memory and high concurrency. In fact, nginx's concurrency is indeed good in the same type of web servers. nginx surpasses Apache's high performance and stability, making it more and more websites using nginx as web servers in China, including portal website channels such as Sina Blog, Sina podcast, and Netease news, discuz! Official Forum, Shui muCommunityAmong other well-known forums, Douban, yupoo album, domestic SNS, thunder online and other emerging Web 2.0 websites.
Nginx is a high-performance WEB and reverse proxy server with many excellent features:
- In the case of high connection concurrency, nginx is a good alternative to Apache servers: nginx is one of the software platforms that are frequently chosen by the owners of virtual host businesses in the United States. it can support responses of up to 50,000 concurrent connections. Thanks to nginx for choosing epoll and kqueue as the development model;
- Less memory consumption: enabling 10 nginx processes with 30 thousand concurrent connections consumes about MB of memory (15 MB * 10 );
- Nginx is an open-source software and can be used for free. The purchase of F5 big-IP, NetScaler and other hardware Server Load balancer switches requires tens of thousands to tens of thousands of RMB 100,000; nginx as a server Load balancer Server: nginx supports both rails and PHP internal services and HTTP proxy servers. nginx is written in C. Both system resource overhead and CPU usage are much more efficient than perlbal;
- As a mail proxy server: nginx is also a very good mail proxy server (one of the earliest development purposes of this product is also as a mail proxy server), last. FM describes the success and wonderful use experience;
- Nginx is a [# installation] Very simple. What is the configuration file? Very simple (Perl syntax is also supported). servers with few buckets: nginx is very easy to start and can run almost without interruption, it does not need to be restarted even if it has been running for several months. you can upgrade the software without interrupting services;
- High Stability: used for reverse proxy, the probability of downtime is minimal.
Why is nginx performance much higher than Apache? This is because nginx uses the latest epoll (Linux 2.6 kernel) and kqueue (FreeBSD) network I/O models, while Apache uses the traditional select model. Currently, squid and memcached, which can withstand high-concurrency access in Linux, use the epoll network I/O model.
- Install nginx, install nginx, you must add the opensuse: Factory: contrib source to the software library, run the command yast2, add the http://download.opensuse.org/repositories/openSUSE:/Factory:/Contrib/openSUSE_11.3/ to the software repository, and then install the latest version of nginx 0.8.8 through the following command
Yast2-I nginx-0.8
Run the following command to establish a system-started connection and start nginx
Chkconfig -- add nginx
Service nginx start
- Configure nginx-based fastcgi-mono-server2 settings, when mono 2.8 is installed, the mono-fastcgi-server2/mono-fastcgi-server4 has been installed, start the facstcgi-mono-server2/4 through the following command method:
# Note: This command enables an application (virtual directory: actual directory) and a 127.0.0.1 local listening port 9000
CD projecthome (it must be executed in the actual directory, and/root will automatically be equal to the actual directory)
Fastcgi-mono-server4/applications =/:/srv/www/htdocs/socket = TCP: 127.0.0.1: 9000
# Add &.
# To automatically run the command when the server is started, you can modify the/etc/init. d/nginx file and add the command to it so that it can automatically start with the nginx server.
# Add the following content to the start part of nginx:
Projecthome =/srv/www/htdocs/
CD $ projecthome
Fastcgi-mono-server4/applications =/: $ projecthome/socket = TCP: 127.0.0.1: 9000 &
Mono-fastcgi-server4,/socket is the listening port,/address is the local IP,/application is the site relative path and the corresponding program, applications this parameter description. net, similar to setting the virtual directory as an application under IIS, mainly. the position of the config has a direct relationship, specific can be viewed through the fastcgi-mono-server4/help, note, add a "&" after the command, you can make it run in the background.
- Modify the configuration file of/etc/ngnix. conf
Server {
Listen 8000.;
SERVER_NAME localhost;
# Charset koi8-r;
# Access_log/var/log/nginx/host. Access. Log main;
Location /{
Root/srv/www/htdocs/;
Index index.html index.htm default. aspx default. aspx;
}
Location ~ \. (Aspx | asmx | ashx | asax | ascx | soap | REM | axd | Cs | config | DLL) $ {
Fastcgi_index default. aspx;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_param script_filename $ fastcgi_script_name;
Include fastcgi_params# Note the location of the fastcgi_params file, which is calculated from the/etc/nginx/location
}
-
- Create a WebService for a simple test:
<% @ WebService Language = "C #" class = "WebService" %>
Using system;
Using system. Web;
Using system. Web. Services;
Using system. Web. Services. Protocols;
[WebService (namespace = "http://example.com/")]
[Webservicebinding (conformsto = wsiprofiles. basicprofile1_1)]
Public class WebService: system. Web. Services. WebService
{
[Webmethod]
Public String helloworld ()
{
Return "Hello World ";
}
[Webmethod]
Public String getuniqueidentifier ()
{
Return guid. newguid (). tostring ("N ");
}
}
The effect of browser Web Service browsing is as follows:
RelatedArticle:
Http://mono-project.com/FastCGI_Nginx
Http://tirania.org/blog/archive/2007/Oct-30.html
Http://www.cnblogs.com/top5/category/211174.html
Http://www.howtoforge.com/installing-nginx-with-php5-and-mysql-support-on-opensuse-11.3
Http://mkdot.net/blogs/slavco/archive/2010/01/23/11726.aspx
Http://www.unixvip.com/category/app/nginx/