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

网站建设做什么会计分录如何制作网页游戏

网站建设做什么会计分录,如何制作网页游戏,微信网站开发框架,潍坊专业网站建设价格一、nginx.conf 配置结构 函数 说明 main 全局配置 event 配置工作模式以及连接数 http http模块相关配置 server 虚拟主机配置,可以有多个 location 路由规则,表达式 upstream 集群、内网服务器(负载均衡也在这里边配&#xff…

一、nginx.conf 配置结构

函数

说明

main

全局配置

event

配置工作模式以及连接数

http

http模块相关配置

server

虚拟主机配置,可以有多个

location

路由规则,表达式

upstream

集群、内网服务器(负载均衡也在这里边配)

二、Nginx配置语法

基本的语法:

指令集组成:每个指令单独写一行,每个指令分号 ";" 分开,每个指令块用大括号 "{ ... }" 分开,大括号的后方没有分号。注释用#号分开。

$符号:$符号为nginx内部提供的一些参数变量。

三、nginx.conf 核心配置文件详解

 

函数

说明

main

全局配置

event

配置工作模式以及连接数

http

http模块相关配置

server

虚拟主机配置,可以有多个

location

路由规则,表达式

upstream

集群、内网服务器(负载均衡也在这里边配)

 

主配置文件详解

#user  nobody;                   #表示当系统在执行worker进程的时候由哪个用户去执行,(默认为nobody)
worker_processes  10;            #逻辑CPU的个数设置的值为:(n-1)# nginx的日志级别:debug info notice warn error crit 等级逐渐升高。#error_log  logs/error.log;      #错误的日志,在编译的时候已经设置相关的路径。
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;#pid        logs/nginx.pid;events {#默认使用epolluse epoll;#每个worker允许的客端最大连接数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       8080;server_name  localhost;#charset koi8-r;#access_log  logs/host.access.log  main;location / {root   html;index  index.html index.htm;}#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;#    }#}}

(一)main 全局配置模块

1、进程用户设置

user root;
worker_processes 10;
worker_rlimit_nofile 65535;

 

  1. user root;
    • 这一配置项指定了 Nginx 工作进程所使用的用户身份。root 是系统中的超级用户,拥有最高权限。不过,从安全角度考虑,不建议让 Nginx 以 root 用户身份运行,因为这会使 Nginx 拥有过高的权限,一旦出现安全漏洞,攻击者可能会获取系统的最高控制权。通常,建议创建一个专门的低权限用户来运行 Nginx。
  2. worker_processes 4;
    • 此配置项用于设置 Nginx 工作进程的数量。Nginx 采用多进程模型,一个主进程(master process)负责管理多个工作进程(worker processes),工作进程负责处理实际的客户端请求。4 代表创建 4 个工作进程。一般而言,可以根据服务器的 CPU 核心数来设置该值,通常设置为 CPU 核心数或者核心数的两倍,这样能充分利用服务器的 CPU 资源。
  3. worker_rlimit_nofile 65535;
    • 该配置项设定了每个 Nginx 工作进程能够打开的最大文件描述符数量。在 Linux 系统里,一切皆文件,包括网络连接、磁盘文件等,每个打开的文件或者连接都会占用一个文件描述符。65535 意味着每个工作进程最多可以同时打开 65535 个文件描述符。当服务器需要处理大量并发连接时,就需要增大这个值,防止出现 “too many open files” 的错误。

2、 nginx日志路径设置

#error_log  logs/error.log;      #错误的日志,在编译的时候已经设置相关的路径放:/var/log/nginx/
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

 3、存放pid的地方

#pid        logs/nginx.pid;     #进程号存在的路径,在编译的时候已经设置相关的路径放:/var/run/nginx/

 (二)、events配置工作模式以及连接数

events {#默认使用epolluse epoll;#每个worker允许客端连接的最大连接数,根据硬件的配置来选值的大小。worker_connections  1024;
}

(三)、http相关网络传输的模块(包含了很多的配置内容)

http {include       mime.types;   #导入外部的文件,文件中为指令块,当前目录的mime.types文件。default_type  application/octet-stream;    #默认的type类型。*********************************************日志模块分析**********************************************************#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '  #access_log 日志的格式,可以自定义格式。#                  '$status $body_bytes_sent "$http_referer" '#                  '"$http_user_agent" "$http_x_forwarded_for"';#access_log  logs/access.log  main;***参数注解区****# $remote_addr               客户端的IP地址# $remote_user               用户名称,可以是 "-"# [$time_local]              访问时间# $request                   请求的内容包括:URL 请求的方法GET、POST# $status                    响应的状态码# $body_bytes_sent           客户端发送的文件主体所包含内容的字节数# $http_referer              记录着用户从哪个访问链接跳转过来的,我们在做日志分析的时候会用到。# $http_user_agent           用户的代理# $http_x_forwarded_for      可以记录客户端的IP**********************************************************************************************************************************sendfile        on;#tcp_nopush     on;#keepalive_timeout  0;keepalive_timeout  65;#gzip  on;server {listen       8080;server_name  localhost;#charset koi8-r;#access_log  logs/host.access.log  main;location / {root   html;index  index.html index.htm;}#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;#    }#}}

mime.types文件

3.1、日志格式

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '  #access_log 日志的格式,可以自定义格式。#                  '$status $body_bytes_sent "$http_referer" '#                  '"$http_user_agent" "$http_x_forwarded_for"';#access_log  logs/access.log  main;***参数注解区****# $remote_addr               客户端的IP地址# $remote_user               用户名称,可以是 "-"# [$time_local]              访问时间# $request                   请求的内容包括:URL 请求的方法GET、POST# $status                    响应的状态码# $body_bytes_sent           客户端发送的文件主体所包含内容的字节数# $http_referer              记录着用户从哪个访问链接跳转过来的,我们在做日志分析的时候会用到。# $http_user_agent           用户的代理# $http_x_forwarded_for      可以记录客户端的IP

3.2、文件的高效传输

    sendfile        on;          #打开,表示文件传输的性能会得到提升,nginx的性能也得到相应的提升。#tcp_nopush     on;          #和sendfile一起使用,表示当我们的数据包累积到一定的大小之后再发送,可以提高传输的效率。先取数据在进行统一分发。

3.3、客户端连接服务器的超时时间(传输完成后保持的时间)

   keepalive_timeout  65;            #以秒为单位,http有keepalive机制,当数据传输完成之后会保持一定时间的连接处于打开状态,如果客户端有新的请求会用此连接去处理。不用创建新的连接,节省资源的开销。

3.4、gzip压缩

#gzip  on;      #内容的传输经过压缩之后体积变小,提升的传输速率,减少了带宽的产生,但是在压缩的过程中会消耗我们系统上CPU的性能。

3.5、server模块,虚拟主机相关配置

    server {listen       8080;                #服务端口号server_name  localhost;           #服务IP、域名#charset koi8-r;#access_log  logs/host.access.log  main;location / {                      #配置页面显示的路由:locationroot   html;index  index.html index.htm;}#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;#    }#}}

3.5.1 在nginx.conf文件中添加新的server模块。
    server {listen       8888;               #指定的服务端口为8888server_name  127.0.0.1;          #指定的服务器的名称是127.0.0.1location / {root   html;index  test.html index.htm;  #访问到的内容为test.html文件            }  

3.5.2 添加test.html文件:/usr/local/nginx/html/test.html 

 

 

3.6、通过include函数的调用server模块的配置,提高文件的可读性。

3.6.1 在nginx.conf文件中定义include调用server模块(支持正则匹配)

可用统一将配置文件放在/usr/local/nginx/conf/conf.d指定的路径下这样方便管理,如:

  • HTTP相关的配置放在:/usr/local/nginx/conf/conf.d/http 目录下
  • TCP相关的配置放在:/usr/local/nginx/conf/conf.d/tcp 目录下
user root;
worker_processes 4;
worker_rlimit_nofile 65535;events {...
}include conf.d/tcp/*.conf;  #TCP相关配置(不能放在下边的HTTP模块中不然会报错);这里的include是指包含/usr/local/nginx/conf/conf.d/tcp路径下所有的.conf。http {...include conf.d/http/*.conf; #HTTP相关配置(需要放在HTTP模块中不然会报错);这里的include是指包含/usr/local/nginx/conf/conf.d/http 路径下所有的.conf
}

http://www.dtcms.com/wzjs/494039.html

相关文章:

  • 优秀的手机网站网店运营具体做什么
  • 什么网站可以找手工活做市场监督管理局投诉电话
  • 深圳外贸网站公司网站优化seo方案
  • 西安软件外包公司有哪些seort什么意思
  • 毕业设计做 做交易网站百度搜索量排名
  • asp网站建设流程网络推广软文范文
  • 免费设计软件下载网站大全百度官网首页登录
  • 盐城网站优化价格网络营销的10个特点
  • 网站备案的幕布是什么网络推广搜索引擎
  • 泰安市房产交易中心官网抖音seo排名软件哪个好
  • 汉口做网站网站seo优化是什么意思
  • wordpress大数据插件seo优化平台
  • 在线编辑图片的网站有哪些网站编辑seo
  • 旅游网站建设怎么做关键词排名是由什么决定的
  • 如何做网站引流衡水今日头条新闻
  • 南京响应式网站建设女教师遭网课入侵直播录屏曝光8
  • 成都专业做网站的公司有哪些网络推广公司怎么找客户
  • 律师怎样做网站百度公司官网首页
  • 南山网站建设深圳信科我们公司想做网络推广
  • 做网站可以卖别的牌子的产品吗班级优化大师手机版下载(免费)
  • 做计划网站建站abc官方网站
  • 注册完域名 如何做网站厦门seo网站推广
  • 个人的视频网站如何做手机百度网页版入口
  • 生产类营销型网站seo相关ppt
  • Wordpress怎么做导航页哪家公司做seo
  • 企业门户网站免费模板seo的基本步骤是什么
  • 网站怎么做访问日志湖南网站营销推广
  • 经典手机网站seo推广方法集合
  • 鸡西做网站班级优化大师使用指南
  • 哪些做调查问卷挣钱的网站网络营销的特点举例说明