当前位置: 首页 > news >正文

无锡中小企业网站制作做网站公司哪家好

无锡中小企业网站制作,做网站公司哪家好,下列关于网站开发中网站上传,琼海建设网站一、主配置文件结构main block#xff1b;#全局块配置全局生效event{#事件驱动相关配置 }http{#http/https协议相关配置段 server { ... }#xff1a;#每个server用于定义一个虚拟主机#xff1b; server { ... server_name root alias location [OPERATOR] URL { ... if CO… 一、主配置文件结构main block#全局块配置全局生效event{#事件驱动相关配置 }http{#http/https协议相关配置段 server { ... }#每个server用于定义一个虚拟主机 server { ... server_name root alias location [OPERATOR] URL { ... if CONDITION { ... } } } } stream{ #tcp协议配置段 }1.全局块全局块主默认的配置文件从开始到event块之间的的一部分内容主要设置影响Nginx整个配置指令影响全局2.event块event块主要涉及到的指令用于响应nginx服务器与用户的网络连接常用于配置时间驱动等模块信息3.http块http块是nginx配置文件中最为重要的块http自己的全局块包括大多数第三方模块配置也可以添加到这个模块中server块也可以包含在这个快中4.server块主要定义虚拟主机5.location块每个server块中可以包含多个location块location块主要用于nginx服务器接收来自客户端的请求的URL字符串进行匹配处理nginx许多功能都是在此进行配置的。二、Nginx正常运行必备的配置user nobody; pid /var/log/nginx/nginx.pid; worker_processes auto; worker_rlimit_nofile 1024; master_process on; error_log /var/log/nginx/error.log; -------------------------------------------------------------------------------------------------------------------------- events { worker_connections 1024; use epoll; accept_mutex on; } -------------------------------------------------------------------------------------------------------------------------- http{ include       mime.types; default_type  application/octet-stream; keepalive_timeout  65; gzip  on; server {listen 80;server_name app.liaoxz.com;root   /usr/local/nginx/html/app/;index  index.html index.htm; } server {listen 8090;server_name abb.liaoxz.com;root /usr/local/nginx/html/abb/;index index.html; } }cpu优化相关参数1.设置worker process 数worker process是nginx实现高并发的主要关键配置这个建议与cpu核心数一致配置work proccess的语法格式worker_processes  number;2.worker_cpu_affinity cpumask ...;worker_cpu_affinity auto [cpumask];将worker进程与cpu进行绑定绑定之后来自同一worker个进程的请求就会直接使用当前所绑定所指定的cpu建议设置成autoauto表示在服务启动时就将worker进程与之绑定。用户及进程相关1.user uesr [group]设置工作进程所使用的用户或组2.pid /PATH/TO/PID_FILE;指定存储nginx主进程进程号码的文件路径3.worker_priority number;指定worker进程的nice值设定worker进程优先级[-20,20]4.worker_rlimit_nofile number;worker进程所能够打开的文件数量上限5.master_process on |off;是否以master/worker模型运行nginx模块装载1.include file | mask;指明包含进来的其它配置文件片断2.load_module file;指明要装载的动态模块事件驱动相关events{1worker_cnnections number;每个worker进程所能打开的最大并发连接数2use method epoll|select|poll指明并发连接请求的处理方法建议使用epolluse epoll;3accept_mutex on |off处理新的连接请求方法on意味着由各worker轮流处理新请求off意味着每个新的请求会通知所有的worker进程}三、Nginx Gzip压缩Gzip功能由模块 ngx_http_gzip_module提供官方站点介绍http://nginx.org/en/docs/http/ngx_http_gzip_module.html 1.Syntax:gzip on | off;Default:gzip off;Context:http, server, location, if in location默认是off不启动Gzip功能设置为on为生效2.Syntax:gzip_buffers number size;Default:gzip_buffers 32 4k|16 8k;Context:http, server, location用于指定缓冲区数量及每个缓存区的大小number 缓冲区数量size 缓存区大小3.Syntax:gzip_comp_level level;Default:gzip_comp_level 1;Context:http, server, location指定压缩程度数字越高表示压缩效率越高但是占用系统资源建议适当设置4.Syntax:gzip_disable regex ...;Default:—Context:http, server, locationThis directive appeared in version 0.6.23.针对不同类型客户端进行选择是否开启gzip功能regex 表示浏览器类型 支持使用正则表达式IE浏览器 MSIE [6-10]\;5.Syntax:gzip_types mime-type ...;Default:gzip_types text/html;Context:http, server, location压缩过滤器仅对此处设定的MIME类型的内容启用压缩功能6.Syntax:gzip_proxied off | expired | no-cache | no-store | private | no_last_modified | no_etag | auth | any ...;Default:gzip_proxied off;Context:http, server, locationEnables or disables gzipping of responses for proxied requests depending on the request and response. The fact that the request is proxied is determined by the presence of the “Via” request header field. The directive accepts multiple parameters:offdisables compression for all proxied requests, ignoring other parameters;expiredenables compression if a response header includes the “Expires” field with a value that disables caching;no-cacheenables compression if a response header includes the “Cache-Control” field with the “no-cache” parameter;no-storeenables compression if a response header includes the “Cache-Control” field with the “no-store” parameter;privateenables compression if a response header includes the “Cache-Control” field with the “private” parameter;no_last_modifiedenables compression if a response header does not include the “Last-Modified” field;no_etagenables compression if a response header does not include the “ETag” field;authenables compression if a request header includes the “Authorization” field;anyenables compression for all proxied requests.nginx作为代理服务器接收到从被代理服务器发送的响应报文后在何种条件下启用压缩功能的off对代理的请求不启用no-cache, no-storeprivate表示从被代理服务器收到的响应报文首部的Cache-Control的值为此三者中任何一个则启用压缩功能其他相关请查阅的官方文档http://nginx.org/en/docs/http/ngx_http_gzip_module.html#gzip_disablehttp{include       mime.types;default_type  application/octet-stream;keepalive_timeout  65;gzip  on;gzip_comp_level 4;gzip_disable MISE [4-6]\;gzip_buffers 32 4k;}四、nginx rewrite功能配置    Rewrite 是nginx提供的一个重要功能其在web服务器中必然会使用到的指令例如在网站结构更改后客户端任可以使用之前使用的URL来进行访问等操作实现URL替换功能Rewrite功能是由ngx_http_rewrite_module模块提供1、rewrite regex replacement [flag]将用户请求的URI基于regex所描述的模式进行检查匹配到时将其替换为replacement指定的新的URI注意如果在同一级配置块中存在多个rewrite规则那么会自下而下逐个检查被某条件规则替换完成后会重新一轮的替换检查因此隐含有循环机制[flag]所表示的标志位用于控制此循环机制如果replacement是以http://或https://开头则替换结果会直接以重向返回给客户端301永久重定向[flag]last重写完成后停止对当前URI在当前location中后续的其它重写操作而后对新的URI启动新一轮重写检查提前重启新一轮循环break重写完成后停止对当前URI在当前location中后续的其它重写操作而后直接跳转至重写规则配置块之后的其它配置结束循环redirect重写完成后以临时重定向方式直接返回重写后生成的新URI给客户端由客户端重新发起请求不能以http://或https://开头permanent:重写完成后以永久重定向方式直接返回重写后生成的新URI给客户端由客户端重新发起请求        location / {          rewrite ^/ http://abb.liaoxz.com/abb;             root   html;            index  index.html index.htm;        }2.if (condition) { ... }引入一个新的配置上下文 条件满足时执行配置块中的配置指令server, locationcondition比较操作符!~模式匹配区分字符大小写~*模式匹配不区分字符大小写!~模式不匹配区分字符大小写!~*模式不匹配不区分字符大小写文件及目录存在性判断-e, !-e-f, !-f-d, !-d-x, !-x3.returnreturn code [text];return code URL;return URL;Stops processing and returns the specified code to a client. 停止处理并将指定的代码返回给客户端。 非标准代码444关闭连接而不发送响应报头。  4.rewrite_log on | off;是否开启重写日志 5.set $variable value;用户自定义变量 五、nginx 后端服务器组配置指令详解nginx支持设置一组服务器作为后端服务器做为反代或负载均衡都会涉及到模块由Module ngx_http_upstream_module模块提供http://nginx.org/en/docs/http/ngx_http_upstream_module.html1.Syntax:upstream name { ... }Default:—Context:httpDefines a group of servers. Servers can listen on different ports. In addition, servers listening on TCP and UNIX-domain sockets can be mixed.用于指定后端服务器组upstream 后面为自定义的后端服务器组默认为轮询调度对后端服务器进行转发处理请求如果后端某一台服务器发生故障调度器服务器会自动将其从组中踢除待恢复后又自动加回组中。2.Syntax:server address [parameters];Default:—Context:upstreamDefines the address and other parameters of a server. The address can be specified as a domain name or IP address, with an optional port, or as a UNIX-domain socket path specified after the “unix:” prefix. If a port is not specified, the port 80 is used. A domain name that resolves to several IP addresses defines multiple servers at once.The following parameters can be defined:weightnumbersets the weight of the server, by default, 1.max_connsnumber该指令用于指定设置组内服务器address 服务器地址[parameters]weightnumber为组内添加权重权重值越高服务器被优先用于服务器组内权重默认为1如果不设置则组内主句轮询处理max_failsnumber设置一个请求失败的次数在一定时间范围内当对组内服务器请求失败可允许超过次数如果请求失败次数超过该值时则认为该服务器为无效默认值也是为1,fail_timeoutnumber 该时间设置有两个作用。一是当多长时间尝试去连接已失效服务器第二个是在max_fails里面说到的在一定时间内对组内服务器请求失败的时间默认为1backup 将组内某台服务器设置为备用服务器只有所有服务器都处于无效情况下该服务器才会被用来处理请求down; 将组内某台服务器设置为永久无效状态。示例http {upstream baks {server 10.1.45.61:80 weight1 max_fails2 fail_timeout30s;server 10.1.45.62:80 weight3;server 127.0.0.1:80 backup;}}3.Syntax:ip_hash;Default:—Context:upstreamSpecifies that a group should use a load balancing method where requests are distributed between servers based on client IP addresses. The first three octets of the client IPv4 address, or the entire IPv6 address, are used as a hashing key. The method ensures that requests from the same client will always be passed to the same server except when this server is unavailable. In the latter case client requests will be passed to another server. Most probably, it will always be the same server as well.该指令用于实现会话保持功能将来自于某一客户端的请求定向到组内任何一台服务器上保证客户端与服务器之间建立稳定的会话只有在该服务器在无效情况下才会被下一个服务器接收和处理实例如下:http {ip_hash;upstream baks {server 10.1.45.61:80 weight1 max_fails2 fail_timeout30s;server 10.1.45.62:80 weight3;server 127.0.0.1:80 backup;}}4.Syntax:keepalive connections;Default:—Context:upstreamThis directive appeared in version 1.1.4.Activates the cache for connections to upstream servers.The connections parameter sets the maximum number of idle keepalive connections to upstream servers that are preserved in the cache of each worker process. When this number is exceeded, the least recently used connections are closed.该指令用于设置为每个worker进程保留的空闲的长连接数量。5.Syntax:least_conn;Default:—Context:upstreamThis directive appeared in versions 1.3.1 and 1.2.2.Specifies that a group should use a load balancing method where a request is passed to the server with the least number of active connections, taking into account weights of servers. If there are several such servers, they are tried in turn using a weighted round-robin balancing method.最少连接调度算法当server拥有不同的权重时其为wlc;6.Syntax:hash key [consistent];Default:—Context:upstreamThis directive appeared in version 1.7.2.Specifies a load balancing method for a server group where the client-server mapping is based on the hashed key value. The key can contain text, variables, and their combinations. Note that adding or removing a server from the group may result in remapping most of the keys to different servers. The method is compatible with the Cache::Memcached Perl library.If the consistent parameter is specified the ketama consistent hashing method will be used instead. The method ensures that only a few keys will be remapped to different servers when a server is added to or removed from the group. This helps to achieve a higher cache hit ratio for caching servers. The method is compatible with the Cache::Memcached::Fast Perl library with the ketama_points parameter set to 160.基于指定的key的hash表来实现对请求的调度此处的key可以直接文本、变量或二者的组合作用将请求分类同一类请求将发往同一个upstream server 转载于:https://blog.51cto.com/liaoxz/1867467
http://www.yutouwan.com/news/185910/

相关文章:

  • 文件传输协议登录网站怎么建企业自己的网站吗
  • 百度云网站空间建设差差软件下载免费
  • 网站设计什么价位做预约的网站
  • 在什么网站可以做推广网站建设作用 名词解释
  • 制作学校网站软件工程课程设计
  • 网站描述关键词做游戏网站的需求分析
  • 做网站是买服务器还是买cdn360seo关键词优化
  • 北京php网站制作网站域名的作用是什么意思
  • 企业网站建设制作wordpress 主题缩略图
  • 一个网站如何做推广东莞 塑胶 网站建设
  • 网站链接是什么注册资金
  • 宏重钢结构东莞网站建设网站代优化
  • 良庆网站建设软件开发app制作公司有哪些
  • 广州市企业网站建设怎么样大连网站建设方案维护
  • 南京城乡建设网站wordpress简约主题下载
  • 做网站需要切图吗seo服务指什么意思
  • 做网站公司商丘邢台企业网站建设公司
  • 做影视网站会侵权犯法吗网站导航栏最多可以做几个
  • 镇平建设局网站公司制作网站价格表
  • 蓝色大气网站模板如何在百度推广自己的产品
  • 网站模板免费都江堰seo
  • 网站分享到朋友圈微信推广引流加精准客户
  • 郑州住房和城乡建设部网站企业网络营销策划案
  • 丽水集团网站建设广告设计制作教程
  • 深圳装饰网站建设设计网站推荐理由
  • 建筑公司企业网站WordPress mx 主题
  • 滁州项目建设公示在哪个网站自助建站平台免费
  • 建设网站石家庄网站开发教程全集
  • 重庆设计公司网站哪里有整站优化
  • 旅游网站建设可行性分析免费简历模板word文档