首页 > 编程知识 正文

vueconfig.js配置文件,yum源的配置文件在哪个目录

时间:2023-05-05 05:43:07 阅读:13836 作者:838

Nginx在运行时,必须至少加载几个核心模块和一个事件类模块。 这些模块运行时支持的配置项称为基本配置——中所有其他模块运行时依赖的配置项。

由于配置项较多,所以把它们按照用户使用时的预期功能分成以下4类:

用于调试、定位的设定项目; 配置项目事件类配置项目,以优化正常运行所需的配置项目性能(一些事件类配置项目被组织在优化性能类中)。 这也属于event{}块,只是为了优化性能。 )一些配置项目未明确配置,未在daemon (即nginx.conf )中配置,与已启用此功能相同。 需要注意

官网对各个模块参数配置的解释说明网址: Nginx中文文档

##代码块中的事件、http、服务器、位置、upstream等都是块配置项。 ###块配置项目可以嵌套。 内层块直接继承外层的高速。 例如,服务器块中的任何配置都基于http块中的现有配置。 # # # nginx工作器进程执行的用户和用户组#语法:用户用户名[组名]默认值:用户nobody nobody # user显示“用户用户名; ”时,用户组名称与用户名相同。 #如果用户在运行configure命令时使用参数--user=usergroup和--group=groupname,则nginx.conf使用参数中指定的用户和用户组。 #用户nobody; # # nginx工作器进程的数量:该数量直接影响性能。 #每个工作器进程都是一个单线程进程,通过调用每个模块来提供各种功能。 如果这些模块不发生阻止的调用,则需要按CPU内核的数量配置进程;相反,如果可能发生阻止的调用,则需要配置稍微多一点的工作器进程。 工作器_ processes 1; ##ssl硬件加速。 #用户可以使用Opnessl提供的命令检查是否存在SSL硬件加速设备。 OpenSSL engine-t # SSL _ engine设备; #守护进程(守护进程)。 远离终端在后台允许的进程。 脱离终端是为了不在任何终端上显示进程执行中的信息。 由此,进程不会被从任何终端产生的信息中断。 关闭####守护进程的模式。 之所以提供这种模式,是因为在放置后用浮水印跟踪调试nginx。 毕竟,在gdb中调试流程时最麻烦的是如何继续跟踪fork推出的子流程。 关闭####master_proccess方法后,master进程本身处理请求,而不是fork worker子进程处理请求#daemon off; 确定Nginx是否作为守护进程运行的默认值为on #master_process off; 是否充当主/工作器的默认值为on##error日志设置##语法: error_log /path/file level; #默认值: error_log/log/error.log error; 如果path/file的值为/dev/null,则不会输出任何日志。 这是关闭错误日志的唯一手段。 #leve的可能值的范围从左到右依次变大。 level级别为error时,将输出error、crit、alert和emerg级别的日志。 输出此级别以上,不输出小于此级别。 #设定的日志级别为debug时,输出所有日志。 由于此数据量非常大,因此必须为/path/file所在的磁盘提供足够的磁盘空间。 要将级别设置为调试,必须在配置时添加----with-- -调试设置项。 #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pID文件(主进程id的PID文件存储路径)的路径) #pid logs/nginx.pid; events { #仅向指定的客户端输出调试级别日志。 语法:名为debug_connection[IP|CIDR] #的设置项实际上属于事件类配置,必须放在events{……}中才能生效。 值可以是IP地址或CIRD地址。 #debug_connection 10.224.66.14; 只有上述IP地址请求才会输出调试级别日志,例如#或debug _ connection 10.224.57.0/24 #,其他请求将继承由error_log配置的日志级别。 #注意:在使用debug_connection之前,必须确保在运行配置时添加了--with-debug参数。 如果没有添加,就不会生效。 worker_connections 1024; }##在核心转储(coredump ) :Linux系统上,如果进程发生错误或收到信号后退出,运行进程时的内存内容(核心映像)将被文件(用于调试) correcore 这称为核心转储(coredump ).http

入其他配置文件 语法:include /path/file#参数既可以是绝对路径也可以是相对路径(相对于Nginx的配置目录,即nginx.conf所在的目录) 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监听的端口#语法:listen address:port [ default(deprecated in 0.8.21) | default_server | [ backlog=num | rcvbuf=size | sndbuf=size | accept_filter=filter | deferred | bind | ssl ] ]#default_server: 如果没有设置这个参数,那么将会以在nginx.conf中找到的第一个server块作为默认server块listen 8080;#主机名称:其后可以跟多个主机名称,开始处理一个HTTP请求时,nginx会取出header头中的Host,与每个server中的server_name进行匹配,以此决定到底由那一个server来处理这个请求。有可能一个Host与多个server块中的server_name都匹配,这时会根据匹配优先级来选择实际处理的server块。server_name与Host的匹配优先级见文末。 server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; #location / { # root html; # index index.html index.htm; #}##location 语法: location [=|~|~*|^~] /uri/ { ... }# location的使用实例见文末。#注意:location时有顺序的,当一个请求有可能匹配多个location时,实际上这个请求会被第一个location处理。location / {proxy_pass http://192.168.1.60; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ .php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ .php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # 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 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 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; # } #}}

 

server_name与Host的匹配优先级首先选择所有字符串完全匹配的server_name如:www.testwab.com其次选择通配符在前面的server_name如:*.testwab.com其次选择通配符在后面的server_name如:www.testwab.*最后选择使用正在表达式才匹配的server_name如:~^.testwab.com$location的使用实例 location = / { # matches the query / only. [ configuration A ] } 只有当用户请求是/时,才会使用该location下的配置 location / { # matches any query, since all queries begin with /, but regular # expressions and any longer conventional blocks will be # matched first. [ configuration B ] } 可以匹配所有请求 location ^~ /images/ { # matches any query beginning with /images/ and halts searching, # so regular expressions will not be checked. [ configuration C ] }

匹配以/images/开头的任何查询并停止搜索

表示匹配URL时忽略字母大小写问题

location ~* .(gif|jpg|jpeg)$ { # matches any request ending in gif, jpg, or jpeg. However, all # requests to the /images/ directory will be handled by # Configuration C. [ configuration D ] }

匹配任何以gif、jpg或jpeg结尾的请求。然而,所有

location的使用实例 —— 以root方式设置资源路径

location /download/ {

           root    /opt/wab/html/;

}          [[[意思是有一个请求的URL是 /download/index/test.html, 那么Web服务器就会返回服务器上 /opt/wab/html/download/index/test.html 文件的内容]]]

location的使用实例 —— 以alias方式设置资源路径

alias也是用来设置文件资源路径的,它与root不同点主要在于如何解读紧跟location后面的uri参数,这将会致使alias与root以不同的方式将用户请求映射到真正的磁盘文件上。

例如:如果有一个请求的URI是/conf/nginx.conf,而用户实际想访问的是 /usr/local/nginx/conf/nginx.conf,则两种方式如下:

         alias:

                           location  /conf {

                                             alias    /usr/local/nginx/conf

                          }

 

        root:

                         location    /conf{

                                            root    /usr/local/nginx

                         }

使用alias时,在URI向实际文件路径的映射过程中,已经把location后配置的 /conf这部分字符串丢弃掉了,因此若path中不加/conf这部分,直接映射回的地址是/usr/local/nginx/nginx.conf 与用户实际想访问的路径不符。root可以放置在http、server、location或if块中,而alias只能放置在location块中。

location的使用实例 —— 以index方式访问首页

有时,访问站点时的URI是/ ,这时返回网站的首页,而这与root和alias都不同。这里用ngx_http_index_module模块提供的index配置实现。index后可以跟多个文件参数,Nginx将会按照顺序来访问这些文件。

location  / {

   root    path;

           index   /index.html   /html/index.php          /index.php


接受到请求后,Nginx首先会尝试访问path/index.php 文件,如果可以访问,就直接返回文件内容结束请求,否则再试图返回path/html/index.php 文件的内容,以此类推。(从后向前)

 

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。