#基本配置:

#user nobody;#配置worker进程运行用户
worker_processes 1;#配置工作进程数目,根据硬件调整、通常等于CPU数量或者2倍于CPU数量 比如四核电脑(可以配置4或者8)

#error_log logs/error.log; #配置日志类型、默认为error级别
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;#配置进程pid文件 【进程编号】

#事件配置:

events {

worker_connections 1024; #配置worker进程连接数量上线,nginx链接的总数等于worker_connections*worker_processes 的值

}

#配置http服务器,利用他的反向代理功能提供负载均衡支持

http {
#http基本配置
include mime.types;#配置nginx支持哪些多媒体类型
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"';
#配置access.log日志及存放路径、并使用上面定义的main日志格式
#access_log logs/access.log main;

sendfile on;#开启高效文件传输模式
#tcp_nopush on;#防止网络阻塞

#keepalive_timeout 0;
keepalive_timeout 65;#长连接超时时间

#gzip on;#开启gzip压缩输出

#多个server配置

server {
listen 8089;
server_name localhost;
location /{#web项目代理地址
proxy_pass http://localhost:8080/;
}
}
server {
listen 8088;
server_name localhost;

#charset koi8-r;

location /ecustom/workflow/form/js {
root D:/OADev/Workspace/ecology-innovation/WebContent;
}

location /{
proxy_pass http://172.16.0.80:8443;
}

#配置404页面

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {#配置50开头的错误页面
root html;
}

#php脚本请求全部转发到Apache处理

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

#php脚本请求全部转发到FastCGI处理

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#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;
#}
#禁止访问.htaccess文件
# 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;#配置服务器默认网站根目录位置,默认为ngnix安装
# index index.html index.htm;#配置首页文件的名称
# }
#}

#配置https服务 ---运维工作

# 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;
# }
#}

}

nginx配置文件详解【nginx.conf】的更多相关文章

  1. nginx之旅(第一篇):nginx下载安装、nginx启动与关闭、nginx配置文件详解、nginx默认网站

    一.nginx下载安装 版本nginx 1.15.5 系统环境centos7.5(本机ip192.168.199.228) 关闭selinux 和防火墙firewall 1.下载 wget http: ...

  2. 一、Nginx配置文件详解

    配置文件介绍 主要有两部分:分别是 main:主体部分 http{}:虚拟主机配置部分 配置指令主要以分号结尾:配置语法:directive value1 [value2 ....] 支持使用的变量 ...

  3. Nginx系列(10)- Nginx配置文件详解

    nginx文件结构 ... #全局块 events { #events块 ... } http #http块 { ... #http全局块 server #server块 { ... #server全 ...

  4. nginx配置文件详解(三)

    nginx配置文件详细解析 nginx安装目录:  /usr/local/nginx 配置文件:  /usr/local/nginx/conf 目录下的 nginx.conf文件 nginx优化方法1 ...

  5. Nginx配置文件详解

    Nginx是一款面向性能设计的HTTP服务器,相较于Apache.lighttpd具有占有内存少,稳定性高等优势. ######Nginx配置文件nginx.conf中文详解##### #定义Ngin ...

  6. Nginx教程(五) Nginx配置文件详解

    一. Nginx配置文件nginx.conf中文详解 #定义Nginx运行的用户和用户组 user www www; #nginx进程数,建议设置为等于CPU总核心数. worker_processe ...

  7. Nginx教程(五) Nginx配置文件详解 (转)

    一. Nginx配置文件nginx.conf中文详解 #定义Nginx运行的用户和用户组 user www www; #nginx进程数,建议设置为等于CPU总核心数. worker_processe ...

  8. Nginx:Nginx配置文件详解

    Nginx是一款面向性能设计的HTTP服务器,相较于Apache.lighttpd具有占有内存少,稳定性高等优势. 如下是Nginx的配置详解: ######Nginx配置文件nginx.conf中文 ...

  9. Nginx配置文件详解与优化建议

    1.概述 今天来详解一下Nginx的配置文件,以及给出一些配置建议,希望能对大家有所帮助. 2.nginx.conf 1)配置文件位置 nginx 安装目录的 conf 文件夹下,例如:/usr/lo ...

  10. nginx实现动静分离--附nginx配置文件详解

    转自http://www.cnblogs.com/1214804270hacker/p/9299462.html 一.认识访问静态资源与访问动态资源的区别 静态资源:指存储在硬盘内的数据,固定的数据, ...

随机推荐

  1. echarts移动端demo

    说明:建议移动端使用的时候自己定制需要的东西,详情看官网 ECharts   效果图: 代码: <!DOCTYPE html> <html style="height: 1 ...

  2. jQuery 控制網頁捲軸移動 & Ignore link '#' method jump action

    $('a.gotoheader').click(function(){ // 讓捲軸移動到 0 的位置 $(); // ignore link "#" method return ...

  3. 莫比乌斯反演求LCM的另一种做法

    一个经典问题 求 \[ \sum_{k=1}^n\mathbb{lcm}(k,n) \] 一般的做法是使用\(\varphi(n)\)函数. 不经典的做法 \[ \begin{align*} \sum ...

  4. 根据SNP的位置从基因组提取上下游序列

      代码如下: #!/usr/bin/perl -w use strict; die "perl $0 <vcf> <genome>" if(@ARGV = ...

  5. Ubuntu下U盘文件只读的解决办法

    转自linux公社:http://www.linuxidc.com/Linux/2012-12/76130.htm Ubuntu下U盘出现文件系统只读的问题了.症状为无法删除U盘中现有文件,无法向U盘 ...

  6. Jenkins+maven+gitlab自动化部署之Jenkins系统管理配置(四)

    一.Jenkins全局工具配置 在jenkins首页依次进入系统管理>>全局工具配置: 1) jdk.git.maven配置 指定其在服务器中的目录位置 二.插件管理 1)依次点开系统管理 ...

  7. Spring之3:ListableBeanFactory

    ListableBeanFactory在BeanFactory的位置见<Spring源码阅览——BeanFactory体系结构> ListableBeanFactory:同样扩展BeanF ...

  8. java微服务的统一配置中心

    为了更好的管理应用的配置,也为了不用每次更改配置都重启应用,我们可以使用配置中心 关于eureka的服务注册和rabbitMQ的安装使用(自动更新配置需要用到rabbitMQ)这里不赘述,只关注配置中 ...

  9. C++程序的多文件组成

    C++程序的多文件组成 [例3.32] 一个源程序按照结构划分为3个文件 // 文件1 student.h (类的声明部分) #include<iostream.h> #include&l ...

  10. python离线安装外部库(第三方库)

    在官网下好外部库,解压后,点击解压后的文件夹,按住shift 右击在命令行中执行 输入 python setup.py install