Home > Backend Development > PHP Tutorial > nginxconf configuration instructions

nginxconf configuration instructions

WBOY
Release: 2016-08-08 09:20:55
Original
1020 people have browsed it

1: The content of the nginx.conf file is as follows:

worker_processes 4; //Refers to 4-core cpu

events {
worker_connections 65535; //Ulimit -n under Linux to view parameter matching
}


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;//Transfer file acceleration

keepalive_timeout 30;//Waiting time for accessing the website

client_max_body_size 6m;//Maximum upload file size

gzip on;//Text file compression and transmission


include/opt/ nginx/conf/vhost/*;//Includes multiple configured websites, the following are examples: 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 ;
                                                                                                                                                                                                                                   Home page
root /opt;

}


location ~ .*$ {
proxy_pass http://127.0.0.1:22; //Dynamic program jump }
location ~ .*.(gif|jpg|jpeg|p ng |bmp|swf|mp4)$ {

                                60d; //                                                                              . *. (HTML)? $ {

Expires 5M; // Caches 5 minutes}

acces_log /opt/nginx/logs/b2b.log; // The default accept.log

error_log/oPT/nginx/logs/b2b_errrrr. 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 one above
rewrite ^/$ /MainCtrl?page=IndexPage last; //Home page Jump
                                                                           location ~ .*.(                      )?$ {
expires 3h;

}

access_log /opt/nginx/logs/auto.log;

error_log /opt/nginx/logs/auto_err.log;

}

Copyright statement: This article is an original article by the blogger and has not been authorized by the author. Reprinting is not allowed with the permission of the blogger.

The above introduces the nginxconf configuration instructions, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template