Nginx Beginner's Guide
Nginx Beginner's Guide
Beginner’s Guide
Starting, Stopping, and Reloading Configuration
Configuration File’s Structure
Serving Static Content english
Setting Up a Simple Proxy Server русский
Setting Up FastCGI Proxying
news
This guide gives a basic introduction to nginx and describes about
some simple tasks that can be done with it. It is supposed download
that nginx is already installed on the reader’s machine. If it is
security
not, see the Installing nginx page. This guide describes how
documentation
to start and stop nginx, and reload its configuration, explains
faq
the structure of the configuration file and describes how to set books
up nginx to serve out static content, how to configure nginx as
community
a proxy server, and how to connect it with a FastCGI
enterprise
application.
nginx has one master process and several worker processes. x.com
blog
The main purpose of the master process is to read and
evaluate configuration, and maintain worker processes.
Worker processes do actual processing of requests. nginx unit
njs
employs event-based model and OS-dependent mechanisms
to efficiently distribute requests among worker processes. The
number of worker processes is defined in the configuration
file and may be fixed for a given configuration or automatically
adjusted to the number of available CPU cores (see
worker_processes).
nginx -s signal
Where signal may be one of the following:
stop — fast shutdown
quit — graceful shutdown
reload — reloading the configuration file
reopen — reopening the log files
nginx -s quit
nginx -s reload
http {
server {
}
}
location / {
root /data/www;
}
location /images/ {
root /data;
}
server {
location / {
root /data/www;
}
location /images/ {
root /data;
}
}
nginx -s reload
server {
listen 8080;
root /data/up1;
location / {
}
}
server {
location / {
proxy_pass http://localhost:8080;
}
location /images/ {
root /data;
}
}
location ~ \.(gif|jpg|png)$ {
root /data/images;
}
server {
location / {
proxy_pass http://localhost:8080/;
}
location ~ \.(gif|jpg|png)$ {
root /data/images;
}
}
server {
location / {
fastcgi_pass localhost:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi
fastcgi_param QUERY_STRING $query_string;
}
location ~ \.(gif|jpg|png)$ {
root /data/images;
}
}
This will set up a server that will route all requests except for
requests for static images to the proxied server operating on
localhost:9000 through the FastCGI protocol.