: 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.