Nginx master profile on the general location of /usr/local/nginx/conf/nginx.conf
Configuration statement format "key value;" (Example: keyname key;)
In the http server can have multiple
In the server can have multiple loctation
The main configuration file includes
A global configuration (the contents outside the parentheses)
user nginx [nginx]; run user (nginx group can not write)
worker_processes 2; Specifies the number of worker process (usually one to one designated in accordance with the number of cores)
01 10 worker_cpu_affinity; (four if the specified allocation CUP core 0,001,001,001,001,000.)
102400 worker_rlimit_nofile; (Nginx specify the maximum number of files a process opens the theoretical value should be the maximum number of open files [ulimit -n to view, modify: ulimit -n new value] [ulimit -u the maximum number of user processes, modify: ulimit -u The new value] as the best of these two values, now is a temporary modification to permanently modify these two commands in the / etc / inner profile)
logs the error_log / the error.log; (log storage position error)
logs pid / nginx.pid; (PID process stowed position)
2 I / O bond matter (events content within brackets)
use epoll; (epoll model used for the core than 2.6 is recommended for improved performance epoll model)
1024 worker_connections; (working number of connections, typically configured as a work number 4096. The single working process complicated, the number of the total number of concurrent server connections X work working process)
3HTTP configuration (http content in parentheses)
Following is a 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"'; (defined log output format, the output format name for main) SUMMARY oF $ Nginx beginning of the built-in variables:
$ Remote_addr client address
$ Remote_user client user
$ Remote_user time
$ Request Request Method
$ Status state, contains the return value, for example, 200,302,301
$ Body_bytes_sent designated body size
$ Http_referer specify what connection from
$ Http_user_agent specify the client browser-related information
$ http_x_forwarded_for write client IP, usually null ]
logs access_log / the access.log main; (access log storage position, follow the main output format)
NO the sendfile; (whether to allow file download or transfer, on to allow)
65 keepalive_timeout; (specify a long connection time)
Following is a server
80 the listen; (listening port) [port but can also write (IP: port number)]
localhost server_name; (domain name)
. 8 UTF-charset; (character set)
logs #access_log / host.access.log main; (designated virtual hosts access log, * can do)
location / {(location match [/] Root)
html root; (When accessing [/] root of time, go inside to find html page)
i ndex index.html index.htm ; (used to define the default home page, look for more types of documents in html inside)
}
The following is in the server
location /status {
ON stub_status; (open state statistics)
OFF access_log; (off logging at this location) [belong maintenance, does not belong to access web pages, so do not store logs]
}
When you enter the URL IP / status, displayed at the contents
Active connections: 2 (the currently active connections) Server the accepts the Handled Requests (already dealt with two handshake two, the total request 1) 2 2. 1 Reading: 0 Writing:. 1 Waiting:. 1 (being read is 0, writing is 1, is waiting for 1)
Nginx process signals can be transmitted using the kill or killall
Resetting the configuration equivalent to HUP -1 (killall -1 nginx)
QUIT quit the process is equivalent to 3 (deletes the PID file)
KILL kill the process is equivalent to 9 (PID does not delete files)
For example killall -s HUP nginx reload