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 一.认识访问静态资源与访问动态资源的区别 静态资源:指存储在硬盘内的数据,固定的数据, ...
随机推荐
- hdu 2018 母牛的故事 动态规划入门题
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2018 设 f[i][j] 表示第i天年龄为j的母牛个数,其中j=4代表所有年龄达到4岁的成年母牛,则: ...
- 【Leetcode_easy】883. Projection Area of 3D Shapes
problem 883. Projection Area of 3D Shapes 参考 1. Leetcode_easy_883. Projection Area of 3D Shapes; 完
- linux如何找回已经删除的文件?lsof
简介 lsof(list open files)是一个列出当前系统打开文件的工具.在linux环境下,任何事物都以文件的形式存在,通过文件不仅仅可以访问常规数据,还可以访问网络连接和硬件.所以如传输控 ...
- 基于TreeSoft实现异构数据同步
一.为了解决数据同步汇聚,数据分发,数据转换,数据维护等需求,TreeSoft将复杂的网状的同步链路变成了星型数据链路. TreeSoft作为中间传输载体负责连接各种数据源,为各种异构数据库之 ...
- linux抓取top命令中数据的方法
top在linux中是一个非常直观的命令,可以清晰地看到各进程对资源的使用情况. 但是如果你想从top命令展示中提取某些数据出来,如果想当然地使用这句命令: top|grep xxx 就会被卡住, ...
- [转帖]libev与libuv的区别
libev与libuv的区别 https://www.cnblogs.com/charlesblc/p/6341280.html 参考: http://blog.csdn.net/w616589292 ...
- [Visual Studio] - Unable to launch the IIS Express Web server 问题之解决
背景 Visual Studio 2015 在 Debug 模式下调试失败. 错误 解决 删除解决方案下 .vs/config 文件夹,重新运行解决方案可进行调试. 参考资料 https://stac ...
- PHP 生成公钥私钥,加密解密,签名验签
test_encry.php <?php //创建私钥,公钥 //create_key(); //要加密内容 $str = "test_str"; //加密 $encrypt ...
- Java中的事务及使用
什么是事务? 事务(Transaction),一般是指要做的或所做的事情.在计算机术语中是指访问并可能更新数据库中各种数据项的一个程序执行单元(unit).事务通常由高级数据库操纵语言或编程语言(如S ...
- Python-04-数据结构
一.数字 整数 Python可以处理任意大小的整数,当然包括负整数,在程序中的表示方法和数学上的写法一模一样,例如:1,100,-8080,0,等等. 计算机由于使用二进制,所以,有时候用十六进制表示 ...