nginx.conf配置文件的简单说明
#nginx 监听原理 先监听端口 --> 再配置域名 -->匹配到就访问local 否则 没有匹配到域名就默认访问第一个监听端口的local地址 # vi nginx.conf
user nobody nobody; # 运 nginx的所属组和所有者
worker_processes ; # 开启两个 nginx工作进程,一般几个 CPU核心就写几
error_log logs/error.log notice; # 错误日志路径
pid logs/nginx.pid; # pid 路径
events {
worker_connections ; # 一个进程能同时处理1024个请求
}
http {
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 on;
keepalive_timeout ; # keepalive超市时间
# 开始配置一个域名,一个server配置段一般对应一个域名
server {
listen ; # 监听端口()
# 在本机所有ip上监听80,也可以写为192.168.1.202:80,这样的话,就只监听192.168.1.202 上的80口
server_name www.heytool.com; # 域名
root /www/html/www.heytool.com; # 站点根目录(程序目录)
index index.html index.htm; # 索引文件
# 可以有多个 location
location / {
#proxy_pass www.baidu.com # 跳到 百度页面 (网址)
root /www/html/www.heytool.com; # 站点根目录(程序目录) (本地的路径)
}
error_page /50x.html;
# 定义错误页面,如果是500错误,则把站点根目录下的50x.html返回给用户
location = /50x.html {
root /www/html/www.heytool.com;
}
}
#nginx 监听原理 先监听端口 --> 再配置域名 -->匹配到就访问local 否则 没有匹配到域名就默认访问第一个监听端口的local地址
//看到ok和successful,说明配置文件没问题
# /usr/local/nginx-1.0.6/sbin/nginx –t
nginx: the configuration file /usr/local/ nginx-1.0.6/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/ nginx-1.0.6/conf/nginx.conf test is successful
#启动 nginx
# /usr/local/nginx-1.0.6/sbin/nginx
#重启 nginx
# /usr/local/nginx-1.0.6/sbin/nginx -s reload
nginx.conf配置文件的简单说明的更多相关文章
- [原]生产环境下的nginx.conf配置文件(多虚拟主机)
[原]生产环境下的nginx.conf配置文件(多虚拟主机) 2013-12-27阅读110 评论0 我的生产环境下的nginx.conf配置文件,做了虚拟主机设置的,大家可以根据需求更改,下载即可在 ...
- Nginx入门讲解——初步认识了解nginx.conf配置文件以及配置多个虚拟主机
本文引自网络进攻学习之用https://blog.csdn.net/weixin_38111957/article/details/81080539 一. 引言上节文章讲述了如何用信号控制Nginx服 ...
- Nginx(二)------nginx.conf 配置文件
上一篇博客我们将 nginx 安装在 /usr/local/nginx 目录下,其默认的配置文件都放在这个目录的 conf 目录下,而主配置文件 nginx.conf 也在其中,后续对 nginx 的 ...
- nginx.conf配置文件里的upstream加入健康检查
查看NGINX启用了那些模块: # ./nginx -V Tengine version: Tengine/ (nginx/) built by gcc (Red Hat -) (GCC) TLS S ...
- Nginx.conf 配置文件详细说明
在此记录下Nginx服务器nginx.conf的配置文件说明, 部分注释收集与网络. #运行用户user www-data; #启动进程,通常设置成和cpu的数量相等worker_process ...
- Nginx -- nginx.conf 配置文件详讲
Nginx服务器配置,nginx.conf文件代码详讲,结合不同楼主的博文得到: #关掉访问日志可以优化服务器 #定义Nginx运行的用户和用户组 #user nobody; #nginx进程数 #如 ...
- Nginx nginx.conf配置文件详细说明
在此记录下Nginx服务器nginx.conf的配置文件说明, 部分注释收集与网络. #运行用户user www-data; #启动进程,通常设置成和cpu的数量相等worker_process ...
- Nginx的nginx.conf配置文件中文注释说明
#运行用户 user www-data; #启动进程,通常设置成和cpu的数量相等 worker_processes 1; #全局错误日志及PID文件 erro ...
- /etc/nginx/nginx.conf配置文件详解
user nginx; #数值和cpu核数个数一致worker_processes 8; #worker与cpu绑定 worker_cpu_affinity 0001 0010 0100 1000 1 ...
随机推荐
- 使用Node.js搭建静态资源服务器
对于Node.js新手,搭建一个静态资源服务器是个不错的锻炼,从最简单的返回文件或错误开始,渐进增强,还可以逐步加深对http的理解.那就开始吧,让我们的双手沾满网络请求! Note: 当然在项目中如 ...
- 通过HtppWebRequest发送图片到服务器并保存
之前写的楼主没有测试,后来发现用起来有点小问题 就修改了一下,现在已经亲测可用 完全没有问题了 下面就开始贴代码了 首先将图片装换成功byte 数组 这个path是图片的路径 例如d:12.png ...
- C语言左值,运算符的优先级以及结合性探讨
刚刚开始看一本书.<C陷阱与缺陷>,相信学习C语言的大家都对这本书有耳闻.今天看到了里面的贪心法则.也即在读到一个字符后,尽可能多的读入更多的字符,直到读入的字符组成的字符串已经不可能再组 ...
- AdPlayBanner:功能丰富、一键式使用的图片轮播插件
AdPlayBanner:功能丰富.一键式使用的图片轮播插件 AdPlayBanner是一个Android平台基于ViewPager实现的轮播图插件,主要用以自动或者手动地播放轮播图,提供了Fresc ...
- How to remotely shut down any PC on same network
Syntax: net viewping (name of victim's PC)shutdown -i Empirical: Try one of the school's public PC R ...
- Data truncation: Data too long for column 'gender' at row 1 出现的原因
创建数据库的代码如下: create database day15 ; use day15 ; create table customer( id varchar(100) primary key, ...
- POI通过模板导出EXCEL文件
一般的EXCEL导出使用POI先创建一个HSSFWorkbook,然后通过不断创建HSSFRow,HSSFCell后设置单元格内容便可以完成导出. 这次在项目中需要用到模板,导出的内容包括(1.模板中 ...
- golang 的 http cookie 用法
golang的http cookie用法 在服务端程序开发的过程中,cookie经常被用于验证用户登录.golang 的 net/http 包中自带 http cookie的定义,下面就来讲一下coo ...
- 创建 macvlan 网络 - 每天5分钟玩转 Docker 容器技术(55)
上一节我们准备好了 macvlan 的实验环境,今天在 host1 和 host2 中创建 macvlan 网络 mac_net1: 注意:在 host2 中也要执行相同的命令. ① -d macvl ...
- 从SAP顾问猝死事件谈顾问加班
今天朋友圈盛传一则消息,说是南瑞集团的一名名为牛耕耘的SAP顾问因为工作强度大,连续不分昼夜加班而猝死在工作岗位上,遗留下年迈的父母.体弱的妻子.刚满周岁的孩子和巨额的债务.我无法证实该消息的真伪,但 ...