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 ...
随机推荐
- WPF里面制作圆角文本框
转自:http://www.cnblogs.com/mengxin523/archive/2010/04/04/1704448.html 本以为WPF里面的XAML会很强大,可以设置很多属性,比如文本 ...
- charles抓取移动端app数据
pc端为mac 移动端为android pc端 1.下载charles并安装 安利一个超好的良心网站(好多好用的软件都可以在上面找到,并且免费): http://xclient.info/search ...
- A网站访问B网站,跨域问题
跨域异常:XMLHttpRequest cannot load ''. No 'Access-Control-Allow-Origin' header is present on the reque ...
- ABP ModuleZero后台框架materialize禁止模拟select和checkbox
使用abp modulezero自带那个后台框架发现一个操蛋的问题,所有的select和checkbox都被改成div模拟的,虽然比原生美观,但有时候真的很难用. 比如说要用select做一个联动菜单 ...
- 1105 C程序的推导过程
- 最近JavaScript的一些收获
开发习惯的上的收获 1,开发过程中,要让整个逻辑展示在一个函数中,中间部分则做可以考虑公用策略优化 2,开发完成至少有三个角度进行测试,正面方面和中立 开发技巧上面的收获 1,驼峰转为‘-’以及‘-’ ...
- pygame入门
pygame入门 说明 在学习pygame时,主要参考了目光博客的教程.目光博客 原教程是2011年写的,年代比较久远了,使用Python2.我学习时使用python3将代码重新实现了一遍,同时补充了 ...
- 3 vue-router 的默认hash 改mode:history去除#号 传参
npm install vue-router --save //安装 传参
- 半夜思考, 为什么建议重写 equals() 方法时, 也要重写 hashCode() 方法
我说的半夜, 并不是真正的半夜, 指的是在我一个人的时候, 我会去思考一些奇怪的问题. 要理解 hashCode() 需要理解下面三个点: hash契约 哈希冲突 哈希可变 第一点: hash 契约指 ...
- html template & iframe
html template & iframe https://bbs.csdn.net/topics/390123946 据说可以利用某些浏览器bug绕过跨域限制,可以也研究下; 由于浏览器对 ...