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

网站建设什么牌子好网站开发所需能力

网站建设什么牌子好,网站开发所需能力,网站规划与开发技术专业,做网站项目的意义ppt介绍目录 一、Nginx 1.1、Nginx 下载 1.2、nginx 基础配置的认识 a#xff09;第一部分#xff1a;全局块 b#xff09;第二部分#xff1a;events 块 c#xff09;第三部分#xff1a;http 块 http 块中 内嵌的 server 块 1.3、一些常用配置 1.3.1、location 匹配级…目录 一、Nginx 1.1、Nginx 下载 1.2、nginx 基础配置的认识 a第一部分全局块 b第二部分events 块 c第三部分http 块 http 块中 内嵌的 server 块 1.3、一些常用配置 1.3.1、location 匹配级别 alocation / blocation clocation ^~  1.3.2、实现反向代理 1.3.3、nginx 配置负载均衡 aweight 权重 bip_hash cfair 一、Nginx 1.1、Nginx 下载 a打开官方网站连接OpenResty - 下载 选择根据电脑型号自行选择这里演示 64位 Windows 版进行下载 zip 文件. PsOpenResty 就是 Nginx. b解压缩后进入以下文件路径. c打开输入 nginx.exe回车即可如下 d打开网页访问 localhost:80即可看到 Nginx 页面OpenResty 就是 Nginx 1.2、nginx 基础配置的认识 在 openresty-1.21.4.2-win64\conf\ 路径下有一个 nginx.conf 文件打开如下 #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 {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 80;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 Apaches document root# concurs with nginxs 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;# }#}}这里有很多注释删除掉以后如下 worker_processes 1; events {worker_connections 1024; } http {include mime.types;default_type application/octet-stream;sendfile on;keepalive_timeout 65;server {listen 80;server_name localhost;location / {root html;index index.html index.htm;}error_page 500 502 503 504 /50x.html;location /50x.html {root html;}}}这里分开来看如下 nginx 配置文件主要有三部分组成 a第一部分全局块 全局块nginx 服务器全局生效的配置命令 worker_processes 1; # 服务器并发处理能力值越大并发能力越强受自身配置限制b第二部分events 块 events影响 nginx 和用户网络的连接. events {worker_connections 1024; #最大连接数1024个需灵活配置 } c第三部分http 块 http块包括文件引入、MIME-TYPE 定义日志自定义、连接超时等. http {include mime.types; # 文件扩展名与文件类型映射表default_type application/octet-stream; # 访问到未定义的扩展名的时候就默认为下载该文件sendfile on; # 日志自定义keepalive_timeout 65; # 超时时间 http 块中 内嵌的 server 块 和虚拟主机有关系主要是未来节省硬件成本. 一个 http 块可以包含多个 server 块而一个 server 块就等于一个虚拟主机. server 块中又抱哈了 server 块 和 location 块 全局 server 块 server {listen 80; # 目前监听的端口号server_name localhost; # 主机名称 location 块 location / { #表示默认首页root html;index index.html index.htm;root  html 就是根路径也就是通过 openresty-1.21.4.2-win64\html\ 路径下去找页面默认是 index.html 页面也就是文章开头展示的页面. 最后是对错误页面的描述 error_page 500 502 503 504 /50x.html;location /50x.html {root html;} 如果请求出现了 500、502、503、504 错误就会进入到 50x.html 页面中一般不会用这些默认的错误页因此可以将这个配置也删除掉。 1.3、一些常用配置 1.3.1、location 匹配级别 拿 echo 插件来举例echo 就是会像网页上输出一些东西. 这里需要先在 server 中配置 default_type  text/html 否则会走默认的 http 块中的下载如下 server {listen 80;server_name localhost;default_type text/html;location / {echo hello nginx;}} 在 openresty-1.21.4.2-win64\ 路径下重新打开一个 cmd 窗口输入 nginx.exe -s reload 进行重启. 打开浏览器输入 localhost:80 即可访问. alocation / / 就表示匹配以 / 开头的所有请求例如 location/a、location/ajfdioabgua ....... blocation 优先级最高表示完全匹配例如 location /a 就表示只匹配路由 location/a其他的都不可以. 配置如下 server {listen 80;server_name localhost;default_type text/html;location / {echo hello nginx;}location /a {echo /a;}} cmd 窗口输入 nginx.exe -s reload 进行重启. clocation ^~  ^~ 优先级比 location / 高但是匹配规则和 location / 类似.   例如 location ^~ /a 就表示匹配以 /a 开头的所有路由. 例如配置如下 server {listen 80;server_name localhost;default_type text/html;location / {echo hello nginx;}location /a {echo /a;}location ^~ /a {echo ^~ /a;}} 重启 nginx 服务. 1.3.2、实现反向代理 修改 nginx.conf 如下 server {listen 80;server_name localhost;default_type text/html;location / {proxy_pass https://www.baidu.com;}} 重启 nginx 访问 localhost 即可转到 https://www.baidu.com. 有一些额外需要注意的如下 location /a {proxy_pass http://ip;}上述配置会导致你在浏览器中输入以下网址 localhost/a/xxx http://ip/a/xxx location /a/ {proxy_pass http://ip/;}上述配置会导致你在浏览器中输入以下网址 localhost/a/xxx http://ip/xxx 1.3.3、nginx 配置负载均衡 通过 upstream 来创建一组需要负载均衡服务默认是轮询策略如果某个服务器挂了自动剔除. upstream group1 {server 192.168.0.12:80;server 192.168.0.12:81;}server {listen 80;server_name localhost;default_type text/html;location /a {proxy_pass https://group1;}} aweight 权重 另外可以通过 weight 来控制需要负载均衡的权重.  权重越大访问到的概率越大. 比如将权重都配置为 1表示两者访问到的概率相同. upstream group1 {server 192.168.0.12:80 weight1;server 192.168.0.12:81 weight1;}server {listen 80;server_name localhost;default_type text/html;location /a {proxy_pass https://group1;}} 或者将 80 端口的权重改为 10让其访问到的概率大一些. upstream group1 {server 192.168.0.12:80 weight10;server 192.168.0.12:81 weight1;}server {listen 80;server_name localhost;default_type text/html;location /a {proxy_pass https://group1;}} bip_hash 每个请求按访问 ip 的hash 结果分配这样子访客固定访问一个后端服务器可以解决session问题 举个例子 A用户固定ip第一次访问到8080 tomcat那么后面就都是访问到这台机器. upstream myserver {ip_hash;server 127.0.0.1:8080;server 127.0.0.1:8081; }cfair 根据后端响应时间来分配请求处理时间短的优先分配. upstream myserver {server 127.0.0.1:8080;server 127.0.0.1:8081;fair; }
http://www.sadfv.cn/news/257962/

相关文章:

  • 网站 制作价格广东哪家网站建设哪家公司好
  • 静态网站怎么做建立网站 知乎
  • 怎么搭建一个网站教程廊坊小程序公司
  • 制作钓鱼网站教程网站的主要功能
  • 莱芜网站网站建设云南建网科技有限公司
  • 北京icp网站备案下载ppt模板幻灯片模板
  • 网站美化教程下载用人名做网站域名
  • 专做展厅设计网站广西论坛网站建设
  • 自己做网站要会什么扶余手机网站开发公司
  • 网站加速器quickq要做网站到哪里做
  • mysql 视频网站开发html设计简单校园网页代码
  • 网站建设费用应该入什么科目北京网站备案流程
  • 做微电影模板下载网站游戏网站规划方案
  • 站长工具怎么关闭一份完整app运营推广方案
  • 河北省建设工程网站本地dede网站怎么上线
  • 高职高专网站建设与维护网站建设口号
  • 自贡企业网站建设公司劳务派遣公司注册条件
  • 网站上线要多久seo的工作内容主要包括
  • 长沙哪个平台做网站好seo服务 公司
  • 美食网页设计模板素材关于seo关键词选择有哪些方法
  • 大连手机网站制作wordpress方向
  • 怎么做考试资料分享网站怎么做软文网站
  • 网站平台建设合同模版商会网站建设方案
  • 旅游网站建设价格网站如何开发触屏版
  • 论企业网站职能建设个人备案的网站名称
  • 网站顶部轮播怎么做的海外网站seo
  • 厦门市建设局综合业务平台网站建网站 找个人
  • html5 单页 响应式 网站模板iis 5 新建网站
  • 怎样建设自已的网站杭州清风室内设计培训学校
  • 阿里云编辑建设好的网站自己做视频网站