#配置worker进程运行用户 nobody也是一个linux用户,一般用于启动程序,没有密码
user nobody;
#配置工作进程数目,根据硬件调整,通常等于CPU数量或者2倍于CPU数量
worker_processes ; #配置全局错误日志及类型,[debug | info | notice | warn | error | crit],默认是error
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; pid logs/nginx.pid; #配置进程pid文件 ###==================================================== #配置工作模式和连接数
events {
worker_connections ; #配置每个worker进程连接数上限,nginx支持的总连接数就等于worker_processes * worker_connections
} ###=================================================== #配置http服务器,利用它的反向代理功能提供负载均衡支持
http {
#配置nginx支持哪些多媒体类型,可以在conf/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日志及存放路径,并使用上面定义的main日志格式
#access_log logs/access.log main; sendfile on; #开启高效文件传输模式
#tcp_nopush on; #防止网络阻塞 #keepalive_timeout ;
keepalive_timeout ; #长连接超时时间,单位是秒 #gzip on; #开启gzip压缩输出 ###----------------------------------------------- #配置虚拟主机
server {
listen ; #配置监听端口
server_name localhost; #配置服务名 #charset koi8-r; #配置字符集 #access_log logs/host.access.log main; #配置本虚拟主机的访问日志 #默认的匹配斜杠/的请求,当访问路径中有斜杠/,会被该location匹配到并进行处理
location / {
#root是配置服务器的默认网站根目录位置,默认为nginx安装主目录下的html目录
root html;
#配置首页文件的名称
index index.html index.htm;
} #error_page /.html; #配置404页面
# redirect server error pages to the static page /50x.html
#error_page /50x.html; #配置50x错误页面 #精确匹配
location = /50x.html {
root html;
} #PHP 脚本请求全部转发到Apache处理
# proxy the PHP scripts to Apache listening on 127.0.0.1:
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} #PHP 脚本请求全部转发到FastCGI处理
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:;
# 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 ;
# listen somename:;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} #配置https服务,安全的网络传输协议,加密传输,端口443,运维来配置
#
# HTTPS server
#
#server {
# listen 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配置详解---学校资料的更多相关文章

  1. Nginx配置详解 http://www.cnblogs.com/knowledgesea/p/5175711.html

    Nginx配置详解 序言 Nginx是lgor Sysoev为俄罗斯访问量第二的rambler.ru站点设计开发的.从2004年发布至今,凭借开源的力量,已经接近成熟与完善. Nginx功能丰富,可作 ...

  2. Nginx高性能服务器安装、配置、运维 (3) —— Nginx配置详解

    四.Nginx 配置详解 YUM方式安装的Nginx默认配置文件放在/etc/nginx目录下,使用Vim编辑/etc/nginx/nginx.conf: ---------------------- ...

  3. nginx配置详解(转)

    Nginx 配置文件详解 user nginx ; #用户 worker_processes 8; #工作进程,根据硬件调整,大于等于cpu核数 error_log logs/nginx_error. ...

  4. Nginx配置详解(转)

    转自:Nginx简介及配置文件详解 一 Nginx简介 Nginx是一款开源代码的高性能HTTP服务器和反向代理服务器,同时支持IMAP/POP3/SMTP代理服务 1.Nginx工作原理 Nginx ...

  5. 前端搭建Linux云服务器,Nginx配置详解及部署自己项目到服务器上

    目录 搭建Linux云服务器 购买与基本配置 链接linux服务器 目录结构 基本命令 软件安装 Linux 系统启动 启动过程 运行级别 Nginx详解 1.安装 方式一:yum安装 方式二:自定义 ...

  6. Nginx配置详解

    序言 Nginx是lgor Sysoev为俄罗斯访问量第二的rambler.ru站点设计开发的.从2004年发布至今,凭借开源的力量,已经接近成熟与完善. Nginx功能丰富,可作为HTTP服务器,也 ...

  7. nginx 配置详解(转)

    nginx概述 nginx是一款自由的.开源的.高性能的HTTP服务器和反向代理服务器:同时也是一个IMAP.POP3.SMTP代理服务器:nginx可以作为一个HTTP服务器进行网站的发布处理,另外 ...

  8. 转发大神nginx配置详解

    序言 Nginx是lgor Sysoev为俄罗斯访问量第二的rambler.ru站点设计开发的.从2004年发布至今,凭借开源的力量,已经接近成熟与完善. Nginx功能丰富,可作为HTTP服务器,也 ...

  9. [转]Nginx配置详解

    Nginx是lgor Sysoev为俄罗斯访问量第二的rambler.ru站点设计开发的.从2004年发布至今,凭借开源的力量,已经接近成熟与完善. Nginx功能丰富,可作为HTTP服务器,也可作为 ...

随机推荐

  1. MySQL随机字符串函数批量插入数据

      简单举个例子: drop table if exists demo1 create table demo1 ( id int primary key auto_increment, name ) ...

  2. H5本地存储技术

    H5 Web存储技术 前言 web存储技术在初期的时候被定义为HTML5的一部分作为其API.后来被独立出来作为一份独立的标准. web存储标准包含localStorage对象和sessionStor ...

  3. python-Web-django-自定义标签

    简化:@register.simple_tag def current_time(token): return datetime.datetime.now().strftime(str(token)) ...

  4. PTA(Basic Level)1016.部分A+B

    正整数 A 的"*D**A(为 1 位整数)部分"定义为由 A* 中所有 *D**A* 组成的新整数 PA.例如:给定 A=3862767,DA=6,则 A 的"6 部分 ...

  5. 洛谷 P2633 Count on a tree 题解

    题面 对于每个点建立一颗主席树: 然后按照树上差分的思想统计主席树的前缀和: lca+主席树+前向星存表就可以了: #include <bits/stdc++.h> #define inc ...

  6. 关闭mysql查询缓存query cache(用户测试性能)

    先对query cache进行查询 mysql> show global variables like '%cache%'; 查看query_cache_size.query_cache_typ ...

  7. MySQL_入手<二>之删--改--查

    接上 上篇文章继续 查询 # 比较运算 # 根据WHERE条件查找数据: = > < >= <= != select * from t_hero where age < ...

  8. Java new运算符解析

    1.创建数组时,不使用new操作符 Person [] a; a[0]=new Person(); //Error:variable a might not have been initialized ...

  9. 1.bash总体介绍

    1.总体介绍1.1 什么是Bash?Bash(Borune-Again SHell)是一个用于Linux操作系统的shell,即命令解释器Bash与sh兼容,并从ksh和csh引进了一些有用的功能,在 ...

  10. 面试之什么是java虚拟机

    java虚拟机体系结构 方法区 堆 java虚拟机栈 本地方法栈 方法区 java虚拟机编译的class文件中二进制数据类型解析数据存在方法区中 是所有线程共享 和存在数据的线程安全问题 当二个线程使 ...