ngnix.conf的配置结构
1.ngnix.conf的配置结构

2.部分配置文件说明
#worker进程可操作的用户
#user nobody;
#设置worker的个数
worker_processes 1;
#错误日志
#error_log logs/error.log;
#日志级别 debug info notice warn error crit
#error_log logs/error.log notice;
#error_log logs/error.log info;
#nginx的进程号
#pid logs/nginx.pid;
#事件处理
events {
#操作模式,默认使用epoll(linux系统使用)
use epoll;
#设置每个worker的客户端最大连接数
worker_connections 1024;
}
#相关网络传输模块
http {
#导入的外部指令(外部文件)mime.types在conf目录下
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"';
#http请求的日志文件
#access_log logs/access.log main;
#打开文件传输
sendfile on;
#与sendfile一起使用,但数据包累计到一定程度以后再去发送
#tcp_nopush on;
#keepalive_timeout 0;
#http保持连接的状态超时时间(单位秒)
keepalive_timeout 65;
#开启内容传输压缩
#gzip on;
#限制最小压缩,小于1字节的文件不会压缩
#gzip_min_length 1
#定义压缩的级别(文件越大,压缩越多,但是cpu占用越高)
#gzip_comp_level 3
#定义压缩文件的类型
gzip_type gzip_types text/plain application/javascript application/x-javascript text/css applicatio n/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png application/ json;|
#服务器配置
server {
#监听的端口
listen 80;
#监听的域名
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
# /匹配的请求地址
location / {
#影射的文件夹,html表示conf的同级目录的html文件夹
root html;
#指定默认的首页
index index.html index.htm;
}
#默认的配置
location / {
#影射的文件夹,html表示conf的同级目录的html文件夹
root html;
#指定默认的首页
index index.html index.htm;
}
#当用户请求 /test,nginx会自动拼接到/home后面,即访问/home/test路径
location /test {
#影射的文件夹,html表示conf的同级目录的html文件夹
root /home;
}
#alias来设置别名,当用户访问/static,nginx影射到 /home/static路径中
location /static {
#影射的文件夹,html表示conf的同级目录的html文件夹
alias /home/static;
}
#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;
}
}
}
3.配置重新加载才生效
进入sbin目录,输入如下路径
./nginx -s reload
ngnix.conf的配置结构的更多相关文章
- FreeSWITCH 体系配置结构
转自:http://www.cnblogs.com/logo-fox/archive/2013/12/09/3465440.html FreeSWITCH总体结构: FreeSWITCH 由一个稳定的 ...
- Apache 中httpd.conf文件配置详解(转载)
httpd.conf文件配置详解 Apache的基本设置主要交由httpd.conf来设定管理,我们要修改Apache的相关设定,主要还是通过修改httpd.cong来实现.下面让我们来看看htt ...
- PHP7中php.ini、php-fpm和www.conf的配置
引自:https://typecodes.com/web/php7configure.html 1 配置php.ini php.ini是php运行核心配置文件: ######避免PHP信息暴露在htt ...
- WampServer 在 httpd.conf 中配置多站点 (IP 配置法:不用每次修改 hosts 文件 + 域名配置法 )
因为要用 ThinkPHP 的当前最新版本 3.2.2,对应要求 PHP 的版本要高于 5.3.0,所以安装了 WampServer 2.2 ( Apache 2.2.21,PHP 5.3.10,My ...
- Php和httpd.conf的配置
http://www.cnblogs.com/homezzm/archive/2012/08/01/2618062.html http://book.51cto.com/art/201309/4096 ...
- redis cluster的conf配置文件配置
redis cluster的conf配置文件配置 master配置文件如下: bind 127.0.0.1 port tcp-backlog timeout tcp-keepalive logleve ...
- httpd.conf简单配置
本文介绍apache中httpd.conf的配置.该配置也可解决打开php文件却变成下载的尴尬情况 1 修改网站根目录查找DocumentRoot有这么一行DocumentRoot "C:/ ...
- 3-nginx.conf参数配置
–#定义Nginx运行的用户和用户组 –user www www; –#nginx进程数,建议设置为等于CPU总核心数. –worker_processes8; –#全局错误日志定义类型,[ debu ...
- redis.conf 具体配置详解
redis.conf 具体配置详解 # redis 配置文件示例 # 当你需要为某个配置项指定内存大小的时候,必须要带上单位, # 通常的格式就是 1k 5gb 4m 等酱紫: # # 1k => ...
随机推荐
- git配置httpd服务-web_dav模式
1,搭建httpd应用 2,修改httpd.conf文件 注释 DocumentRoot "/data/httpd/htdocs" 注释 <Directory "/ ...
- scratch编程——画笔模块画各种同心图案
我们今天是要用画笔来画出不同的同心图案,在画之前,我们先来了解一下画笔模块: 1.画笔模块的用法 画笔模块的用法就是在舞台上留下不同颜色粗细的线条,它的默认是情况是抬笔,我们在使用的时候要让角色移动到 ...
- javascript中的设计模式之发布-订阅模式
一.定义 又叫观察者模式,他定义对象间的依照那个一对多的依赖关系,当一个对象的状态发生改变时,所有依赖于它的对象都将的到通知.在javascript中,我们一般用时间模型来替代传统的发布-订阅模式 二 ...
- 关于RecyclerView(二)设置EmptyView
首先重写一个RecyclerView类 package com.onepilltest.others; import android.content.Context; import android.s ...
- Elasticsearch及相关插件的安装
Elasticsearch及相关插件的安装 1.安装Elasticsearch并启动服务 2.安装第三方插件 2.1.Head插件 是Elasticsearch的一个集群管理工具,可以通过它来查看和搜 ...
- cpp求职
//Created by Arc on 2020/5/23 //////// Created by snnnow on 2020/5/20.//////面向对象的程序设计-期中测试// 根据题目实现求 ...
- gerrit安装指南
Gerrit的基本介绍 Gerrit 是一个Git服务器,它基于 git 版本控制系统,使用网页界面来进行审阅工作.Gerrit 旨在提供一个轻量级框架,用于在代码入库之前对每个提交进行审阅,更改将上 ...
- 1-Numpy的通用函数(ufunc)
一.numpy“通用函数”(ufunc)包括以下几种: 元素级函数(一元函数):对数组中的每个元素进行运算 数组级函数:统计函数,像聚合函数(例如:求和.求平均) 矩阵运算 随机生成函数 常用一元通用 ...
- Python time ctime()方法
描述 Python time ctime() 函数把一个时间戳(按秒计算的浮点数)转化为time.asctime()的形式.高佣联盟 www.cgewang.com 如果参数未给或者为None的时候, ...
- CF 题目选做
写省选的题目对noip没什么大用 关键是 细节题或者是思考题比较重要 练思维自然是CF比较好了 把我见到的比较好的CF题放上来刷一刷. LINK:Complete the projects 就是说一个 ...