zoukankan      html  css  js  c++  java
  • Nginx的安装和配置文件详细说明

    1.nginx的安装

    1.1解压nginx文件

    1.2 nginx文件说明

    3.启动nginx

    4.验证是否启动成功

    2 配置文件(说明)

    user  nginx;nginx的运行账号(rpm安装时会自动创建这个账号),也可以写成user nginx nginx表示用户和组

    worker_processes  10;工作进程数(worker),一般等于cpu内核数或者两倍

    worker_rlimit_nofile 100000;文件描述符数量

    error_log   /var/log/nginx/error.log;

    #error_log  /var/log/nginx/error.log  notice;

    #error_log  /var/log/nginx/error.log  info;

    pid        /var/run/nginx.pid;

    events {

        worker_connections  1024;每个worker进程允许的连接数

        use epoll;网络I/O事件模型,linux推荐用epoll,FreeBSD推荐用kqueue

    }

    http {

        include       /etc/nginx/mime.types;include用来引用其他的配置文件,即可以按照需求将不同的配置写到不同的文件里面

        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"';

    定义日志格式,格式名字设为main

        access_log  /var/log/nginx/access.log  main;

    access日志文件的路径,采用上面定义的main 格式记录

        sendfile        on;

        tcp_nopush      on;

        tcp_nodelay     on;

        server_tokens   off;

        gzip            on;启用压缩

        gzip_static     on;启用HTTPGzipStatic模块(不在corestandard模块组中,rpm安装带了此模块)

        gzip_comp_level 5;压缩级别,1最小最快,9最大最慢

        gzip_min_length 1024;压缩的最小长度,小于此长度的不压缩(此长度即header中的Content-Length)

        keepalive_timeout  65;

        limit_zone   myzone  $binary_remote_addr  10m;

        # Load config files from the /etc/nginx/conf.d directory

        include /etc/nginx/conf.d/*.conf;

        server {

            limit_conn   myzone  10;

            listen       80;端口

            server_name  _;域名

            #charset koi8-r;

            #access_log  logs/host.access.log  main;

            location / {

                root   /usr/share/nginx/html;主目录

                index  index.html index.htm;

            }

    ………………

     
  • 相关阅读:
    angular2监听页面大小变化
    angular如何引入公共JS
    angular使用Md5加密
    angular4模块中标签添加背景图
    angular使用sass的scss语法
    设置angular公共样式表
    更改angular的默认端口
    angular模拟web API
    RN与webview通讯
    shell通过ping检测整个网段IP的网络状态脚本
  • 原文地址:https://www.cnblogs.com/xumaodun/p/4867463.html
Copyright © 2011-2022 走看看