Centos 7 nginx-1.12.0 配置学习(一)
[root@bogon nginx]# vim nginx.conf #user nobody; #运行用户
worker_processes ; #启动进程,通常设置成和cpu核心数相等 #全局错误日志及PID文件
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
#epoll 是多路复用IO中的一种方式
#仅用于linux2.6以上的内核,可以大大提高nginx的性能
use epoll
#单个后台worker process进程的最大并发链接数
worker_connections ; #并发总数是worker_processes与worker_connections 的乘积
#在设置了反向代理的情况下,max_clients = worker_processes * worker_connections /
#为什么除4,是一个经验值
#根据以上条件,正常情况下的nginx server 可以应付的最大连接数为: * =
#worker_connections的值设置与物理内存大小有关
#因为并发受IO约束,max_clients的值须小于系统可以打开的最大连接数
#面系统可以打开的最大的文件数和内存大小成正比,一般1G内存的机器可以打开的文件数大约是10W左右
#看看360M的内存可以打开多少文件句柄:
# cat /proc/sys/fs/file-max
# 输出34336 < ,既并发连接总数小于系统可以打开的文件句柄,系统可以承受
#其实质也就是根据主机的物理CPU和内存进行配置
#理论的并发总数可能会和实际有所偏差,因为主机还有其它的工作进程消耗
#解除最大连接数设定:
终极解除 linux 系统的最大进程数和最大文件打开数限制: #vim /etc/security/limits.conf # 添加如下的行 * soft nproc * hard nproc * soft nofile * hard nofile
} http {
#设定mime类型,类型由mime.type文件定义
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,如是下载等IO高负载可设off
sendfile on;
#tcp_nopush on;
#连接超时时间
#keepalive_timeout ;
keepalive_timeout ; #开启gzip压缩
#gzip on; #设定请求缓冲
client_header_buffer_size 128k;
large_client_header_buffers 128k; #设定虚拟主机配置
server { #侦听8080端口
listen ;
#定义使用 www.nginx.cn
server_name www.nginx.cn; #charset koi8-r; #设定本虚拟主机的访问日志
access_log logs/host.access.log main; #默认请求
location / {
#设定服务器的默认网站根目录位置
root html;
#设定首页索引文件名称
index index.html index.htm index.php;
} #定义错误提示页面
#error_page /.html; # redirect server error pages to the static page /50x.html
#
error_page /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # 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;
#} # 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 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;
# }
#} }
今天太晚了,环境还没有测试,有待验证!
Centos 7 nginx-1.12.0 配置学习(一)的更多相关文章
- Centos7 编译安装 Nginx PHP Mariadb Memcached 扩展 ZendOpcache扩展 (实测 笔记 Centos 7.3 + Openssl 1.1.0e + Mariadb 10.1.22 + Nginx 1.12.0 + PHP 7.1.4 + Laravel 5.4 )
环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1611.iso 安装步骤: 1.准备 1.0 查看硬 ...
- nginx 升级为最新版 nginx -1.12.0
标签:nginx 公司目前使用的nginx版本比较低(nginx-1.0.12),请网络安全公司做了一下“远程安全评估”,发现有下列漏洞: nginx URI处理安全限制绕过漏洞(CVE-2013-4 ...
- nginx HTTP/2.0 配置
1.前言 最近无意中看到http2.0消息,发现自己的博客虽然配了https,但并没有配置http2.0,所以搞了个玩玩,本以为配个参数就搞定了,结果还是折腾了一个小时. 2.过程 nginx并没有默 ...
- zabbix 3.2.6+centos 7 +nginx 1.12+ mysql 5.6+ Grafana +php 5.6
先只记录关键点 1.nginx.MYSQL 用官方的YUM库安装 2.CENTOS升级到最新 3.ZABBIX 官方RPM安装,然后下载源码库,源码中的PHP复制至NGINX的配置目录 4.NGINX ...
- centos+uwsgi+nginx+python+django服务器安装配置
1.ssh登录后使用fdisk –l查看需要格式化硬盘的名称: 2.运行fdisk /dev/vdb,对数据盘进行分区,按照提示,依次输入n,p,1,两次回车,wq,分区开始.(注意数据盘的名称,和阿 ...
- nginx 1.14.0 配置部署 thinkphp 5.1
开始接触NGINX,配置tp5配了半天,找不到具体原因,于是用网上搜索到的配置复制粘贴搞定. 感谢 https://blog.csdn.net/qq_36431213/article/details/ ...
- centos 7 安装solr7.3.0 配置mysql
1.下载solr :wget http://archive.apache.org/dist/lucene/solr/7.3.0/solr-7.3.0.tgz 或者去官网自己下:http://arc ...
- CentOS 7 yum安装nginx-1.12.0
CentOS 7 中的 yum 没法直接使用 yum install nginx 这个指令去安装nginx,因为nginx这个服务不是yum库中自带的.图1是官方提供的大致安装步骤,图2是官网提供的多 ...
- maven私库nexus2.11.4迁移升级到nexus3.12.0
nexus简介 nexus是一个强大的maven仓库管理器,它极大的简化了本地内部仓库的维护和外部仓库的访问. nexus是一套开箱即用的系统不需要数据库,它使用文件系统加Lucene来组织数据 .n ...
- WordPress 4.8 安装配置教程 (基于 centos 7.3, php 7.0, mysql 5.7.19, nginx 1.12.1)
最近想要整个 blog,记录自己工作.学习中的点滴.Wordpress 自然是首选,因为内容才是关键,所以也就不怕别人说太 low.网上大部份都是讲 wordpress 配合 apache 的安装教程 ...
随机推荐
- Spartan6系列之器件详细介绍、选型参考
1. 概述 Spartan6系列是一类低成本高容量的FPGA,采用45nm低功耗敷铜技术,能在功耗.性能.成本之间很好地平衡:Spartan6系列内部采用双寄存器.6输入的LUT,还有一系列 ...
- 十年后我不会log,还是活的很好啊
混迹于互联网也一两年了,出于喜爱与生活压力依然会从事很久.迟迟不写博客,大概是觉得知识与经验积累在笔记上时不时看看就好了,而实际情况是笔记很少翻,遇到问题搜博客和百度依然是首选,故开通博客记录自己工作 ...
- Commons_IO_FileUtils的使用
commos_io.jar包下载地址:http://commons.apache.org/proper/commons-io/download_io.cgi 官方文档地址:http://commons ...
- linux 下mysql无法启动 mysql.sock
在公司装的一键安装的lnmp环境,启动mysql时候发现mysql.sock不存在, 然后我进行查找 最后在 /usr/local/mysql/bin/mysql_safe 重新启动下 然后启动 ...
- scala学习(3)-----wordcount【sparksession】
参考: spark中文官方网址:http://spark.apachecn.org/#/ https://www.iteblog.com/archives/1674.html 一.知识点: 1.Dat ...
- 40条常见的移动端Web页面问题解决方案
1.安卓浏览器看背景图片,有些设备会模糊.想让图片在手机里显示更为清晰,必须使用2x的背景图来代替img标签(一般情况都是用2倍).例如一个div的宽高是100100,背景图必须得200200,然后b ...
- Luogu P4503 [CTSC2014]企鹅QQ
思路 如果直接暴力的比较的话,不用想也知道会超时 所以考虑另一种方法,将前缀和的思想运用到hash中.用两个hash,一个从前往后记录,一个从后往前记录,然后枚举哪一位是不相同的,然后删掉这一位,将这 ...
- [Algorithm] 4. Ugly Number II
Description Ugly number is a number that only havefactors 2, 3 and 5. Design an algorithm to find th ...
- Linux iostat-监视系统输入输出设备和CPU的使用情况
推荐:更多linux 性能监测与优化 关注:linux命令大全 iostat命令被用于监视系统输入输出设备和CPU的使用情况.它的特点是汇报磁盘活动统计情况,同时也会汇报出CPU使用情况.同vmsta ...
- docke容器使用
Docker 容器使用 Docker 客户端 docker 客户端非常简单 ,我们可以直接输入 docker 命令来查看到 Docker 客户端的所有命令选项. runoob@runoob:~# do ...