nginx.conf 范例

# 指定nginx运行的用户 和用户组
#user nobody;

# nginx进程数(最合适的数值是cpu的核数,也可以是cpu核数的2倍)
worker_processes 1;

# 设置错误日志文件存放路径(日志级别 -从低到高:debug | info | notice | warn | error | crit)
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

# 设置存储nginx进程id的pid文件存放路径(pid是控制系统中的重要文件)
# pid logs/nginx.pid;

# 工作模式与连接数上线
events {
# use用来指定nginx的工作模式
# use epoll
#设置单个进程最大连接数
worker_connections 1024;
}

# http服务器配置部分
http {
# 导入类型配置文件
include mime.types;
# 设定默认文件类型为 二进制流
default_type application/octet-stream;
# 指定日志的输出格式:
# remote_user:客户端用户名;
# status:请求状态;
# http_referer:父级网页(从哪个网页进入这里来的);
# http_x_forwarded_for:客户端ip地址
#log_format main 'remote_user [request"'
# 'body_bytes_sent "http_user_agent" "http_cookie"';
# 配置nginx日志文件存储路径,名称。配置 access_log off则不记录日志
# access_log logs/access.log main2;
# 开启高效文件传输模式,sendfile指令 指定nginx是否调用sendfile函数来输出文件,
# 对于普通应用设置为on,如果用来进行下载等应用磁盘IO重负载应用,可设置为off,
# 以平衡磁盘与网络I/O处理速度,降低系统的负载。注意⚠️ 如果图片显示不正常 把这个改成off
sendfile off;
# 防止网络阻塞
#tcp_nopush on;
# 设置客户端连接保持活动的超时时间。超过这个设定时间后(65秒) 服务器会关掉这个连接
#keepalive_timeout 0;
keepalive_timeout 65;
# gzip模块设置
# 是否开启gzip压缩
gzip on;
# 虚拟主机的配置部分
server {
# 监听端口(此nginx服务占用的端口)
listen 80;
# 域名(可以有多个,空格隔开)
server_name localhost;
# test proxy_pass
location /s {
rewrite .* /bach-erp/prd/views/Product/PriceChange/[email protected];
proxy_pass http://127.0.0.1:88;
}
# bach 工程静态资源走 90 端口
location /bach/ {
rewrite ^/(.) http://127.0.0.1:90/1;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ .php {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
include servers/
;
}

你可能感兴趣的:(nginx.conf 范例)