Nginx configuration file details

Source: Internet
Author: User
Tags epoll
Userwwwwww; # define the users running Nginx and the worker_processes8; # Number of processes. Generally, the number of processes is smaller than the number of CPUs. # [Debug | info | notice | warn | error | crit] error_log/data1/logs/nginx_error.logcrit; # error log definition type pid/usr/loca


User www;
# Define the users and groups for running Nginx
Worker_processes 8;
# Number of processes, usually smaller than the number of CPUs.
# [Debug | info | notice | warn | error | crit]
Error_log/data1/logs/nginx_error.log crit;
# Error log definition type
Pid/usr/local/webserver/nginx. pid;
# Process files
# Specifies the value for maximum file descriptors that can be opened by this process.
Worker_rlimit_nofile 65535;
# The maximum number of file descriptors opened by an nginx process. the theoretical value should be that the maximum number of opened files (ulimit-n) is the same as the number of nginx processes, but the nginx allocation requests are not so even, therefore, it is best to be consistent with the value of ulimit-n.
# Use [kqueue | rtsig | epoll |/dev/poll | select | poll];
Events
{
Use epoll; # reference the event model
Worker_connections 65535; # maximum number of connections of each process (maximum connection = number of connections x number of processes)
}
# Set the http server
Http
{
Include mime. types; # file extension and file type ing table
Default_type application/octet-stream; # default file type
# Charset gb2312; # default encoding
Server_names_hash_bucket_size 128; # Size of the hash table with the server name
Client_header_buffer_size 32 k; # size limit of uploaded files
Large_client_header_buffers 4 32 k; # set request latency
Client_max_body_size 8 m; # set request delay
Sendfile on; # enable the efficient file transfer mode
Tcp_nopush on; # prevent network congestion
Tcp_nodelay on; # prevent network congestion
Keepalive_timeout 60; # timeout
# FastCGI is to improve the performance of the website-reduce resource usage and improve access speed. For more information about fastCGI, see: http://www.fastcgi.com
Fastcgi_connect_timeout 300;
Fastcgi_send_timeout 300;
Fastcgi_read_timeout 300;
Fastcgi_buffer_size 64 k;
Fastcgi_buffers 4 64 k;
Fastcgi_busy_buffers_size 128 k;
Fastcgi_temp_file_write_size 128 k;
Gzip on;
Gzip_min_length 1 k; # minimum compressed file size
Gzip_buffers 4 16 k; # compression buffer
Gzip_http_version 1.0; # the compressed version (1.1 by default, and 1.0 is used for the front-end squid2.5
Gzip_comp_level 2; # compression level
Gzip_types text/plain application/x-javascript text/css application/xml;
# Compression type. text/html is already included by default, so you don't need to write any more below. of course, if you write it, there will be no problem, but there will be a warn
Gzip_vary on;
# Limit_zone crawler $ binary_remote_addr 10 m; # use this function when you enable the IP address connection restriction.
# VM configuration
Server
{
Listen 80;
Server_name www.opendoc.com.cn
Index index.html index.htm index. php;
Root/data0/htdocs/opendoc;
Location ~ . *. (Php | php5 )? $
{
# Fastcgi_pass unix:/tmp/php-cgi.sock;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fcinclude GI. conf;
}
# Cache images
Location ~ . *. (Gif | jpg | jpeg | png | bmp | swf) $
{
Expires 30d;
}
# Cache JS CSS
Location ~ . *. (Js | css )? $
{
Expires 1 h;
}
# Log settings
Log_format access $ remote_addr-$ remote_user [$ time_local] "$ request"
$ Status $ body_bytes_sent "$ http_referer"
"$ Http_user_agent" $ http_x_forwarded_for;
Access_log/data1/logs/access. log access;
}
}

Related Article

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.