nginx.conf 基础配置
### 全局块开始### #配置允许运行nginx服务器的用户和用户组
user nobody; #配置允许nginx进程生成的worker process 数
worker_processes 1; #配置nginx服务器运行对错误日志的存放路径
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #配置nginx服务器运行时的pid文件存放路径和名称
pid logs/nginx.pid; ### 全局块结束### ### events块开始### events {
#配置事件驱动模型
use epoll;
#配置最大连接数
worker_connections 1024;
} ### events块结束### ### 全局块结束### ### HTTP块开始###
http {
# 定义MIME-Type ,查看mime.types文件
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"'; #access_log logs/access.log main; # 配置允许使用sendfile方式传输
sendfile on; #tcp_nopush on; #配置连接超时时间
keepalive_timeout 65; #gzip on; ### server块开始###
### 配置虚拟主机myServer1###
server {
# 配置监听端口和主机名称(基于名称)
listen 80;
server_name myServer1; #charset koi8-r; #配置请求处理日志存放路径
access_log logs/host.access.log main; # 配置处理/service1/location1 请求的location
location /service1/location1 {
root /myweb;
index index1.html;
} # 配置处理/service1/location2 请求的location
location /service1/location2 {
root /myweb;
index index2.html;
} # 配置错误页面
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 {
root html;
}
}
### 配置虚拟主机myServer2###
server {
# 配置监听端口和主机名称(基于ip)
listen 8082;
server_name 192.168.1.3; #charset koi8-r; #配置请求处理日志存放路径
access_log logs/host.access.log; # 配置处理/service2/location1 请求的location
location /service2/location1 {
root /myweb;
index index2.html;
} # 对location的uri进行更改
location /svr2/loc2 {
alias /myweb/server2/location2;
index index.svr2-loc2.htm;
} # 错误页面404.html 做了重定向
error_page 404 /404.html; location = /404.html {
root /myweb;
index 404.htm;
}
}
### server块结束### }
### HTTP块结束###
nginx.conf 基础配置的更多相关文章
- nginx 的基础配置[转]
nginx 的基础配置 分类: 工具软件2013-11-13 23:26 11人阅读 评论(0) 收藏 举报 目录(?)[-] 管理配置文件 全局配置 虚拟机server配置 location配置 ...
- 2.4 Nginx服务器基础配置指令
2.4.1 nginx.conf文件的结构 2.4.2配置运行Nginx服务器用户(组) 2.4.3配置允许生成的worker process数 2.4.4 配置Nginx进程PID存放路径 2.4. ...
- 大神教你Nginx常用基础配置方案
Nginx的fastcgi模块参数设置 Nginx 有两个配置文件fastcgi_params.fastcgi.conf,两者唯一的区别是,fastcgi.conf 多一个参数 SCRIPT_FILE ...
- nginx.conf中配置laravel框架站点
nginx.conf配置如下: user nginx nginx;worker_processes 4; error_log logs/error.log error; pid logs/nginx. ...
- nginx入门篇----nginx服务器基础配置
1.nginx.conf文件结构... #全局块 events{ ... } http #http块{ ...
- Nginx配置文件(nginx.conf)配置详解(2)
Nginx的配置文件nginx.conf配置详解如下: user nginx nginx ; Nginx用户及组:用户 组.window下不指定 worker_processes 8; 工作进程:数目 ...
- Nginx配置文件(nginx.conf)配置详解
Nginx的配置文件nginx.conf配置详解如下: user nginx nginx ; Nginx用户及组:用户 组.window下不指定 worker_processes 8; 工作进程:数目 ...
- Nginx 1.10.1 版本nginx.conf优化配置及详细注释
Nginx 1.10.1 的nginx.conf文件,是调优后的,可以拿来用,有一些设置无效,我备注上了,不知道是不是版本的问题,回头查一下再更正. #普通配置 #==性能配置 #运行用户 user ...
- 虚拟主机ip配置,nginx.conf文件配置及日志文件切割
今天粗略整理了一下虚拟主机配置,nginx.conf文件的配置,及日志文件的切割,记录如下: nginx虚拟主机配置:1.IP地址配置,2.绑定ip地址和虚拟主机详情:1.ip地址的配置:ifconf ...
随机推荐
- 树莓派与Arduino Leonardo使用NRF24L01无线模块通信之基于RF24库 (一) 配置与测试
引脚连接说明 与树莓派的连线 NRF24L01 => 树莓派 GND => GND VCC => 3.3V CE = ...
- 微信小程序之Flex布局
微信小程序页面布局方式采用的是Flex布局.Flex布局,是W3c在2009年提出的一种新的方案,可以简便,完整,响应式的实现各种页面布局.Flex布局提供了元素在容器中的对齐,方向以及顺序,甚至他们 ...
- DotNetty 跨平台的网络通信库
长久以来,.Net开发人员都非常羡慕Java有Netty这样,高效,稳定又易用的网络通信基础框架.终于微软的Azure团队,使用C#实现的Netty的版本发布.不但使用了C#和.Net平台的技术特点, ...
- hdu 1556 Color the ball(树状数组)
链接:http://acm.hdu.edu.cn/showproblem.php?pid=1556 题意:N个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数[a,b]之间的气球 ...
- day02--Python基础二(基础数据类型)
一.数据与数据类型 1 什么是数据? x=10,10是我们要存储的数据 2 为何数据要分不同的类型 数据是用来表示状态的,不同的状态就应该用不同的类型的数据去表示 3 数据类型 数字(int) 字符串 ...
- 怎样使用ADO中的UpdateBatch方法(200分)
诸位: 我在使用ADO组件(ADOQuery.ADODataSet)的BatchUpdate模式时,系统竟不认识UpdateBatch.CancelBatch方法.这是怎么回事?我的运行环境是Win2 ...
- Flyway的第一次认识
1. 引言 想到要管理数据库的版本,是在实际产品中遇到问题后想到的一种解决方案,当时各个环境的数据库乱作一团,没有任何一个人(开发.测试.维护人员)能够讲清楚当前环境下的数据库是哪个版本,与哪个版本 ...
- C++模板学习笔记
一个有趣的东西:实现一个函数print, 输入一个数组, 输出数组的各个维度长度. eg. ], b[][], c[][][]; print(a); //(2, 4) print(b); //(3, ...
- 【BZOJ4036】按位或(Min-Max容斥,FWT)
[BZOJ4036]按位或(Min-Max容斥,FWT) 题面 BZOJ 洛谷 题解 很明显直接套用\(min-max\)容斥. 设\(E(max\{S\})\)表示\(S\)中最晚出现元素出现时间的 ...
- BZOJ2878 [Noi2012]迷失游乐园 【基环树 + 树形dp + 期望dp】
题目链接 BZOJ2878 题解 除了实现起来比较长,思维难度还是挺小的 观察数据范围发现环长不超过\(20\),而我们去掉环上任何一个点就可以形成森林 于是乎我们枚举断掉的点,然后只需求出剩余每个点 ...