首页 > 系统相关 >NGINX

NGINX

时间:2023-11-26 22:34:11浏览次数:21  
标签:log Nginx worker NGINX error 进程 logs

目录

运行中Nginx 进行间的配置

在正式服务的产品环境下,部署Nginx 时都是使用一个master 进行来管理多个worker 进程,一般情况下,worker进程的数量与服务器上的CPU 核心数相等。每一个worker 进程是繁忙的 它们真正的提供互相网服务,master 进程则很"清闲",只负责监控和管理worker进程。worker进程之间通过共享内存、原子操作等一些进行间通信机制来实现负载均衡等功能

Nginx 是支持单进程(master进程)提供服务的,那为什么产品环境下要按照master-worker 方式配置同时启动多个进程那?这样做的好处主要有以下两点:

由于master 进程不会对用户请求提供服务,只用于管理真正提供服务的 worker进程,所以。。。

Nginx 配置的通用语法


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    use epoll
    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;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       90;
        server_name  localhost;

        location / {
            root   html;
            index  index.html index.htm;
        }

        location ^~ /api/ {
			rewrite ^/api/(.*)$ /$1 break;
			proxy_pass http://localhost:8080;
        }
        
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

}

标签:log,Nginx,worker,NGINX,error,进程,logs
From: https://www.cnblogs.com/czzz/p/17858109.html

相关文章

  • nginx负载均衡 报错 “验证视图状态 MAC 失败。如果此应用程序由网络场或群集托管,请确
    在网上搜寻了很久看了很多关于验证视图状态MAC失败的解决方法。大部分人都说是在页里或web.config里加EnableEventValidation="false"EnableViewStateMac="false"ViewStateEncryptionMode="Never"这些属性的设置。但是这并不从根本上解决问题,相反这样做了反而更加不安全。我......
  • nginx 配置 采用二级跳转方式搭建 nginx+iis(aspx)
    #采用二级跳转方式nginx+iis(aspx)upstreamnginx.alayun.vip{least_conn;serverlocalhost:6666max_fails=30fail_timeout=10s;serverlocalhost:7777max_fails=30fail_timeout=10s;serverlocalhost:8888max_fails=30fail_timeout=1......
  • 使用PhpStudy配置Nginx解决跨域问题
    系统:Windows如果你是用phpstudy来进行lnmp的集成环境,你想解决跨域问题是很简单的:处理步骤:第一步:找到你前端要请求的后端接口的url的域名:比如:http://localhost2/index.php/index/test/helloworld那么域名就是localhost2第二步:找到域名对应的nginx配置文件位置打开phpstudy......
  • ingress-nginx
    下载资源文件,并修改#curl-khttps://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/baremetal/deploy.yaml-odeploy.yaml##修改三处镜像拉取地址为国内地址,修改nodePort为LoadBalancer#vimdeploy.yaml#image:registry.k8s.io/ing......
  • find 查找.tar结尾的文件 unzip 批量解压 sed常用 监控linux磁盘根分区 统计 Nginx 访
    1、查找当前目录下所有以.tar结尾的文件然后移动到指定目录:find.-name“*.tar”-execmv{}./backup/;❝注解:find–name主要用于查找某个文件名字,-exec、xargs可以用来承接前面的结果,然后将要执行的动作,一般跟find在一起用的很多,find使用我们可以延伸-mtime查找修改......
  • nginx-配置文件详解
    详解nginx配置worker_processes1;events{worker_connections1024;}http{includemime.types;default_typeapplication/octet-stream;sendfileon;keepalive_timeout65; #主机一个nginx可以同时运行多个主机 #......
  • Nginx安装
    下载Nginx:https://nginx.org/en/download.html1、首先安装ngnix所需的依赖的文件yuminstall-ygccgcc-c++yuminstall-ygccautomakeautoconflibtoolmakeyuminstall-ypcrepcre-develyuminstall-yzlibzlib-develyuminstall-yopensslopenssl-devel2、下......
  • caddy 替代nginx? caddy测试体验
    安装官网:https://caddyserver.com帮助文档:https://caddy2.dengxiaolong.com/docs/runningcadddy也是一个守护进程的前后台守护应用,后台服务一直监听cli的操作所有所有的service的操作都支持优势目前来看caddy的的优势是==nignx+acme.shUbuntu下安装sudoaptinstall-......
  • nginx-通过配置不同的虚拟主机实现,不同的uri访问不同资源
    先来一个配置再来另外一个这两个地址对应的域名都配置解析了,并且解析的ipv4地址是你的服务器ip,且上面配置文件中的内容都在服务器做了相应的配置,对应的路径下的资源是需要准备好的(比如网站或图片或静态html)这些都设置好了以后就可以生效了......
  • nginx-下载安装与配置
    nginx下载从官网下载,使用命令在linux下载即可,这个是目前稳定版最新的1.24.0版本,如果想要用旧版本直接修改版本号即可(旧版本我用的是1.12.2)下载需要使用wget命令,默认是没有的#安装wgetyuminstallwget#建议直接下载到合适的地方先切换cd/usr/local#新版wgethtt......