Nginx basic configuration description 1

Source: Internet
Author: User
Tags epoll

Copy codeCode: user nfsnobody; # users and groups used
Worker_processes 8; # specify the number of work-derived Processes
Error_log/usr/local/web/nginx.0.8.15/nginx_error.log crit; # file address of the log record
Pid/usr/local/web/nginx.0.8.15/nginx. pid; # path strength for PID Storage
Worker_rlimit_nofile 65535; # maximum file descriptor
Events
{
Use epoll; # use the event model. Generally, Linux2.6 + uses the epoll model.
Worker_connections 65535; # maximum number of connections
}
Http
{
Include mime. types;
Default_type application/octet-stream;
Server_names_hash_bucket_size 128; # hash_table
Client_header_buffer_size 32 k; # buffer size of the Request Header
Large_client_header_buffers 4 32 k; # maximum Request Header Buffer size
Client_max_body_size 8 m; # maximum client request 8 M
Sendfile on; # transfer a file
Tcp_nopush on;
Keepalive_timeout 60; #60 seconds timeout
Tcp_nodelay on;
Fastcgi_connect_timeout 300; # The following fastcgi module configuration
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; # configuration of the following gzip modules
Gzip_min_length 1 k;
Gzip_buffers 4 16 k;
Gzip_http_version 1.0;
Gzip_comp_level 2;
Gzip_types text/plain application/x-javascript text/css application/xml;
Gzip_vary on;
Server
{
Listen 80; # listening port
Server_name www.test2.com; # host Name
Index index.html index.htm index. php; # default homepage
Root/usr/local/web/www/; # file directory
Error_page 404 403 http://admin.test.com/404.htm; # default 404 page
Location ~ . * \. (Php | php5 )? $ # Php cgi Module
{
# Fastcgi_pass unix:/tmp/php-cgi.sock;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fcinclude gi. conf;
}
Location ~ . * \. (Gif | jpg | jpeg | png | bmp | swf) $
{
Expires 30d;
}
Location/# URL rewriting Module
{
Index. php;
If (! -F $ request_filename ){
Rewrite (. *)/admin. php;
}
Try_files $ uri // index.html;
}
Location ~ . * \. (Js | css )? $
{
Expires 1 h;
}
# Log Module-record nginx logs
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/usr/local/web/nginx.0.8.15/logs/access. log access;
}
}

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.