nginx配置文件详解【nginx.conf】
#基本配置:
#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】的更多相关文章
- nginx之旅(第一篇):nginx下载安装、nginx启动与关闭、nginx配置文件详解、nginx默认网站
一.nginx下载安装 版本nginx 1.15.5 系统环境centos7.5(本机ip192.168.199.228) 关闭selinux 和防火墙firewall 1.下载 wget http: ...
- 一、Nginx配置文件详解
配置文件介绍 主要有两部分:分别是 main:主体部分 http{}:虚拟主机配置部分 配置指令主要以分号结尾:配置语法:directive value1 [value2 ....] 支持使用的变量 ...
- Nginx系列(10)- Nginx配置文件详解
nginx文件结构 ... #全局块 events { #events块 ... } http #http块 { ... #http全局块 server #server块 { ... #server全 ...
- nginx配置文件详解(三)
nginx配置文件详细解析 nginx安装目录: /usr/local/nginx 配置文件: /usr/local/nginx/conf 目录下的 nginx.conf文件 nginx优化方法1 ...
- Nginx配置文件详解
Nginx是一款面向性能设计的HTTP服务器,相较于Apache.lighttpd具有占有内存少,稳定性高等优势. ######Nginx配置文件nginx.conf中文详解##### #定义Ngin ...
- Nginx教程(五) Nginx配置文件详解
一. Nginx配置文件nginx.conf中文详解 #定义Nginx运行的用户和用户组 user www www; #nginx进程数,建议设置为等于CPU总核心数. worker_processe ...
- Nginx教程(五) Nginx配置文件详解 (转)
一. Nginx配置文件nginx.conf中文详解 #定义Nginx运行的用户和用户组 user www www; #nginx进程数,建议设置为等于CPU总核心数. worker_processe ...
- Nginx:Nginx配置文件详解
Nginx是一款面向性能设计的HTTP服务器,相较于Apache.lighttpd具有占有内存少,稳定性高等优势. 如下是Nginx的配置详解: ######Nginx配置文件nginx.conf中文 ...
- Nginx配置文件详解与优化建议
1.概述 今天来详解一下Nginx的配置文件,以及给出一些配置建议,希望能对大家有所帮助. 2.nginx.conf 1)配置文件位置 nginx 安装目录的 conf 文件夹下,例如:/usr/lo ...
- nginx实现动静分离--附nginx配置文件详解
转自http://www.cnblogs.com/1214804270hacker/p/9299462.html 一.认识访问静态资源与访问动态资源的区别 静态资源:指存储在硬盘内的数据,固定的数据, ...
随机推荐
- HTML布局水平导航条2制作
前两个博文导航条都不是铺满水平的浏览器的,很多导航条样式都是随着浏览器的移动,是100%.此外前两个博文导航条都是块状点击的,也就是给a标签加宽高,设置成块状显示,点击的时候不一定要点文字,只要点击该 ...
- 前端研究CSS之内联元素块级化/区域大小/文字和图标的位置
做了一天的小按钮基本都是文字+小图标的组合,问题挺多处理的不好,现在总结一下做个了断. //页面结构 <span class="b"> <a href=" ...
- Python:使用第三方库xlwt来写Excel
继上一篇文章使用xlrd来读Excel之后,这一篇文章就来介绍下,如何来写Excel,写Excel我们需要使用第三方库xlwt,和xlrd一样,xlrd表示read xls,xlwt表示write x ...
- JDBC缓冲池配置druid.properties
driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/mytest?characterEncoding=UTF-8 ...
- Linux shell 中 & && [] [[]] () [] 含义
| 语法:command 1 | command 2 功能:把第一个命令 command 1 执行的结果作为 command 2 的输入传给 command 2 & & 放在启动参数后 ...
- RS232标准与TTL/COM小常识
1.TTL电平标准 输出 L: <0.8V : H:>2.4V. 输入 L: <1.2V : H:>2.0V 2.CMOS电平标准 输出 L: <0.1*Vcc : H: ...
- 在被调用函数中获取资源及C++中的引用
#include <iostream> using namespace std; struct Teacher{ char name[64]; int age; }; //在被调用函数 获 ...
- 【Qt】Qt5.12连接MySQl5.7(亲自测试成功)
目录 00. 目录 01. Qt5.12连接MySQL5.7测试代码 02. Qt5.12连接MySQL5.7问题描述 03. 解决办法 04. 结果测试 05. 打赏 00. 目录 01. Qt5. ...
- 【Leetcode】746. Min Cost Climbing Stairs
题目地址: https://leetcode.com/problems/min-cost-climbing-stairs/description/ 解题思路: 官方给出的做法是倒着来,其实正着来也可以 ...
- PPPoE中间人拦截以及校园网突破漫谈
本文首发于PPPoE中间人拦截以及校园网突破漫谈,转载请注明出处. PPPoE中间人拦截以及校园网突破漫谈 校园生活快结束了,之前还有点未完成的想法,趁着这两天有兴趣搞搞. 此文面向大众是那种在校园内 ...