Nginxconf configuration instructions

Source: Internet
Author: User
: This article describes how to configure nginxconf. if you are interested in the PHP Tutorial, refer to it. 1: The content of the nginx. conf file is as follows:

Worker_processes 4; // 4-core cpu

Events {
Worker_connections 65535; // In linux, check the ulimit-n parameter match.
}


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 "';

Sendfile on; // File Transfer Acceleration
Keepalive_timeout 30; // website access wait time

Client_max_body_size 6 m; // maximum size of the uploaded file

Gzip on; // compressed text file transfer

Include/opt/nginx/conf/vhost/*; // contains multiple configuration websites. the following example shows B2B. conf and auto. conf.
}

2: The content of the B2B. conf file is as follows:

Server {
Listen 80;
Server_name www.b2bxxx.cn b2bxxx.cn;

Location/{// home page
Root/opt/zhuhuionline;
Index index.html index.htm;
}

Location ^ ~ /Static/{// static file
Root/opt;
}

Location ~ . * $ {
Proxy_pass http: // 127.0.0.1: 22; // dynamic program jump
}

Location ~ . * \. (Gif | jpg | jpeg | png | bmp | swf | mp4) $ {
Expires 60d; // cache for 60 days
}

Location ~ . * \. (Js | css )? $ {
Expires 3 h; // cache for 3 hours
}
Location ~ . * \. (Html )? $ {
Expires 5 m; // cache for 5 minutes
}

Access_log/opt/nginx/logs/B2B. log; // Default access. log
Error_log/opt/nginx/logs/B2B _err.log; // default error. log
}

3: The content of auto. conf is as follows:

Server {
Listen 80;
Server_name www. autodesign. club autodesign. club;

Location ^ ~ /Auto_static /{
Root/opt;
}

Location ~ . * $ {
Proxy_pass http: // 127.0.0.1: 33; // The port is different from the above
Rewrite ^/$/MainCtrl? Page = IndexPage last; // page jump
}

Location ~ . * \. (Gif | jpg | jpeg | png | bmp | swf | mp4) $ {
Expires 60d;
}

Location ~ . * \. (Js | css )? $ {
Expires 3 h;
}

Access_log/opt/nginx/logs/auto. log;
Error_log/opt/nginx/logs/auto_err.log;

}

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

The configuration of nginxconf is described above, including some content. if you are interested in the PHP Tutorial, please help.

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.