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

做电影网站用什么格式好含山微信搭建网站建设

做电影网站用什么格式好,含山微信搭建网站建设,网站平台建设是什么,青岛logo设计公司排名nginx----web服务器 一、nginx http就是apache#xff0c;在国内很少。 nginx是开源的#xff0c;是一款高性能#xff0c;轻量级的web服务软件。 稳定性高#xff0c;而且版本迭代比较快#xff08;修复bug速度比较快#xff0c;安全性快#xff09; 消耗系统资源…nginx----web服务器 一、nginx http就是apache在国内很少。 nginx是开源的是一款高性能轻量级的web服务软件。 稳定性高而且版本迭代比较快修复bug速度比较快安全性快 消耗系统资源很低http的请求并发连接单台服务器开源支持30000-50000个并发请求。系统资源全部分配给nginx 单个节点的nginx一般支持20000个并发。 1.1、nginx的功能 1、静态文件服务静态页面可以直接提高静态文件服务html css jsp。处理静态页面的响应速度很快效率很好。 2、代理正向代理反向代理。可以实现负载均衡高可用和故障转移。 3、动态内容处理nginx并不能直接处理动态请求可以通过中间件nginx 中间件phptomat mysql把动态请求转发给后端服务器。 4、支持加密的httphttps 5、可以实现重定向。 6、虚拟主机一个nginx可以配置多个域名和站点。 7、nginx自带缓存。 8、性能可以扩展。处理能力可以随时调整。 1.2、nginx的应用场景 静态页面 转发动态请求 反向代理负载均衡 缓存服务 1.3、编译过程中代码解释 ./configure --prefix/usr/local/nginx \ --usernginx \ --groupnginx \ --with-http_ssl_module \ ##支持https的加密功能ss/tls --with-http_v2_module \ ##支持http2.0协议--with-http_realip_module \ ##支持nginx获取客户端的真实ip地址 --with-http_stub_status_module \ ##支持nginx获取访问状态信息的功能 --with-http_gzip_static_module \ ##支持页面压缩功能 --with-pcre \ ##支持prce库 --with-stream \ ##支持4层代理的模块 --with-stream_ssl_module \ ##支持对tcp连接的加密 --with-stream_realip_module ##支持从代理协议中获取客户端的真实ip地址make -j4 make install #启动四个cpu进行 conf 配置文件目录 html 工作目录 50x.html默认的访问操作打开的页面 index.html默认的访问主页 logs 日志目录 访问和报错日志 sbin nginx的二进制启动脚本 ln -s /usr/local/nginx/sbin/nginx /usr/sbin/ #让系统识别nginx的二进制脚本 1.3.1、nginx的常用命令 nginx -t 检测nginx.conf配置文件的语法是否正确 nginx -v 显示nginx的版本 nginx -V显示版本和配置项 nignx -s 信号 stop 关闭nginx reload 重新加载nginx如果更改了配置文件nginx -s reload 无需重新启动服务。 systemctl daemon-reload 二、课后重新编译安装nginx rpm -q nginx ##检查yum是否安装yum -y remove nginx ##有则卸载cd /opt rz -E rz waiting to receive.systemctl stop firewalld ##关闭安全机制 setenforce 0yum -y install gcc pcre-devel openssl-devel zlib-devel openssl openssl-devel ##配置编译环境useradd -M -s /sbin/nologin nginx ##添加程序用户tar -xf nginx-1.22.0.tar.gz ##源码解压cd /nginx-1.22.0/ ## 进入nginx的文件夹配置暗转路径以及相关组件./configure --prefix/usr/local/nginx \ --usernginx \ --groupnginx \ --with-http_ssl_module \ --with-http_v2_module \ --with-http_realip_module \ --with-http_stub_status_module \ --with-http_gzip_static_module \ --with-pcre \ --with-stream \ --with-stream_ssl_module \ --with-stream_realip_modulemake -j 4 make install ##编译和安装[roottest1 nginx-1.22.0]# cd /usr/local/ [roottest1 local]# ls bin etc games include lib lib64 libexec nginx sbin share srcchown -R nginx.nginx nginx/ ##更改权限[roottest1 local]# cd nginx [roottest1 nginx]# ll 总用量 4 drwxr-xr-x. 2 nginx nginx 4096 7月 1 16:04 conf drwxr-xr-x. 2 nginx nginx 40 7月 1 16:04 html drwxr-xr-x. 2 nginx nginx 6 7月 1 16:04 logs drwxr-xr-x. 2 nginx nginx 19 7月 1 16:04 sbin[roottest1 nginx]# cd conf/ [roottest1 conf]# ls fastcgi.conf koi-utf nginx.conf uwsgi_params fastcgi.conf.default koi-win nginx.conf.default uwsgi_params.default fastcgi_params mime.types scgi_params win-utf fastcgi_params.default mime.types.default scgi_params.default [roottest1 conf]# cd .. [roottest1 nginx]# ls conf html logs sbin [roottest1 nginx]# cd html/ [roottest1 html]# ls 50x.html index.htmlln -s /usr/local/nginx/sbin/nginx /usr/sbin/ ##做一个软连接让系统能够识别nginx的指令[roottest1 opt]# nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successfulvim /lib/systemd/system/nginx.service ##设置系统控制系统能对nginx这个软件的运行状态进行控制[Unit] Descriptionnginx - high performance web server Documentationhttp://nginx.org/en/docs/ Afternetwork-online.target remote-fs.target nss-lookup.target Wantsnetwork-online.target [Service] Typeforking PIDFile/usr/local/nginx/run/nginx.pid ExecStart/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf ExecReload/bin/kill -s HUP $MAINPID ExecStop/bin/kill -s TERM $MAINPID [Install] WantedBymulti-user.targetcd /usr/local/nginx/mkdir run ##修改nginx的配置文件把进程文件pid文件的位置指向到设置的位置drwx------. 2 nginx root 6 7月 1 16:14 client_body_temp drwxr-xr-x. 2 nginx nginx 4096 7月 1 16:04 conf drwx------. 2 nginx root 6 7月 1 16:14 fastcgi_temp drwxr-xr-x. 2 nginx nginx 40 7月 1 16:04 html drwxr-xr-x. 2 nginx nginx 58 7月 1 16:14 logs drwx------. 2 nginx root 6 7月 1 16:14 proxy_temp drwxr-xr-x. 2 root root 6 7月 1 16:24 run drwxr-xr-x. 2 nginx nginx 19 7月 1 16:04 sbinchown nginx.nginx runcd conf/vim nginx.confpid /usr/local/nginx/run/nginx.pid;nginx -tsystemctl daemon-reloadsystemctl restart nginx面试题如果出现了500怎么来排查这个错误 1、查看日志 2、查看内部服务器的服务是否启动。 3、查看防火墙的规则配置是否有限制。 4、查看硬件是否负载过高。 三、nginx.conf 3.1、nginx.conf 1、全局模块 worker_processes 1;--------工作进程数设置成服务器内核数的2倍一般不超过8个超过8个反正会降低性能4个1-2个 #user nobody;------#默认的程序用户就是nginx,这里可以保持注释无需修改 pid /usr/local/nginx/run/nginx.pid;----------#pid文件的位置 events { worker_connections 1024;}----------#events模块决定了ngin能够处理的连接数连接数和worker_connections的数值相乘—1*1024。 处理进程的过程必然涉及配置文件和展示页面也就是涉及打开文件的数量 linux默认打开的文件就是1024个 vim /etc/security/limits.conf ##进程数量更改 限制先改进程数量才能生效默认1024。 *soft nproc 65535----#能打开的进程最大数的软限制是65535 *hard nproc 65535----#能打开的进程最大数的硬限制是65535 *soft nofile 65535-------#软限制进程打开文件数的最大值65535 *hard nofile 65535----------#硬限制进程打开文件数的最大值65535 配置要生效只能重启这是系统初始化的一个环节。 http { include mime.types; default_type application/octet-stream; #http转发和处理http请求设置代理正向代理反向代理缓存。定义日志格式重定向配置 include mime.types;------#文件扩展名于文件类型的映射表。nginx能够打开的文件和支持的文件类型。 default_type application/octet-stream;--------------#默认支持的文件类型 。.html .htm .jsp .js .php #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访问日志的格式error.log也是一样的格式#access_log logs/access.log main;-------##默认的访问日志的存放路径 sendfile on;—#支持文件发送和下载 #tcp_nopush on;–#默认就是异步非阻塞模式功能 #keepalive_timeout 0; keepalive_timeout 65;–#连接保持时间单位为秒/s。 #gzip on;----#gzip模块设置是否开启页面压缩功能。 ##开启web服务的模块 server {listen 80;#nginx的默认监听端口server_name localhost;#配置站点的域名#charset koi8-r;#网页的字符集#access_log logs/host.access.log main; #网页匹配的工作目录的地址和支持的打开页面的文件类型。location /xy102(URI) {root html/opt/test1(URL); #192.168.168.10/opt/test1/xy102/index.html #家目录。nginx工作目录的家目录/usr/local/nginx/html index index.html index.htm;}错误日志位置 tail -f /usr/local/nginx/logs/error.log访问是缓存清除缓存 #alisa也是指匹配nginx的工作目录 root 换成 alisa alisa是绝对路径。URL/URI 3.2、root和alias的区别 root的匹配模式 拼接 root的工作目录访问的是uri /xy102 location /xy102 /opt/test1/ 拼接为/opt/test1/xy102 alias匹配nginx的工作目录路径是绝对路径 location /xy102 alias /opt/test1/xy102/ alias只能写在http模块当中server模块的location模块里面。 root 可以写在server模块也可以在http也可以在location中。 alias匹配工作目录不能使用重定向功能。 3.3、全局模块 work_processes 1:指定进程数 events模块决定了能够处理的连接数 stream四层代理模块 http模块 转发和处理http请求设置代理正向代理反向代理缓存。定义日志格式重定向配置 在http模块当中包含 server块 http里面可以有多个server模块 在server模块当中包含 location模块 在server当中可以有多个location。 实验1#统计访问状态 Active connections:1 #当前活动的连接数 server accepts handled requests #表示已经处理的连接数 36 36 36 #三个数从左往右已经处理的连接数成功建立连接的次数已经处理的请求数 Reading:0 writing:1 Waiting:0 Reading:表示服务端正在从客户端读取请求的数据 writing:表示服务端正在把响应数据发送给客户端 Waiting:表示有连接处于空闲状态等待新的请求。 server里写入统计访问状态 location /status {stub_status on;#打开状态统计功能access_log off;#关闭status的访问日志}访问192.168.168.10/status 结果如下 实验2基于密码的授权进行访问控制 yum -y install httpd-tools #先安装工具 location / 根目录加密 vim nginx.conf #access_log logs/host.access.log main;location / {root html;index index.html index.htm;auth_basic secret;#开启用户密码验证auth_basic_user_file /usr/local/nginx/passwd.db;#使用指定的加密文件}yum -y install httpd-toolshtpasswd -c /usr/local/nginx/passwd.db dn [roottest1 nginx]# chown nginx passwd.db [roottest1 nginx]# chmod 400 passwd.db需要输入设置的用户名和对应设置的密码进行访问 实验3基于客户端的访问控制 ip地址来进行控制 #添加控制规则 vim /usr/local/nginx/conf/nginx.confdeny 192.168.168.20;allow all;用192.168.168.20测试结果 实验4基于域名的nginx主机 vim nginx.conf server {listen 80;server_name www.xy102.com;charset utf-8;access_log logs/www.xy102.com.access.log;#access_log logs/host.access.log main;location / {root /var/www/html/xy102;index index.html index.htm;}#新增加域名访问server {listen 80;server_name www.ly.com;charset utf-8;access_log logs/www.ly.com.access.log;#access_log logs/host.access.log main;location / {root /var/www/html/ly;index index.html index.htm;}error_page 500 502 503 504 /50x.html;location /50x.html {root html;}}vim /etc/hosts----本地映射192.168.168.10 www.xy102.commkdir -p /var/www/html/xy102echo 我们都爱学习 /var/www/html/xy102/index.htmlcurl www.xy102.com 我们都爱学习192.168.168.10 www.xy102.com www.ly.com #域名可以用同一个IP地址mkdir -p /var/www/html/lyecho 我真帅 /var/www/html/ly/index.htmlcurl www.ly.com 我真帅 实验5基于ip地址的虚拟主机 ifconfig ens33:0 192.168.168.100/24 [roottest1 conf]# ifconfig ens33: flags4163UP,BROADCAST,RUNNING,MULTICAST mtu 1500inet 192.168.168.10 netmask 255.255.255.0 broadcast 192.168.168.255inet6 fe80::20c:29ff:fe1a:7434 prefixlen 64 scopeid 0x20linkether 00:0c:29:1a:74:34 txqueuelen 1000 (Ethernet)RX packets 10190 bytes 895390 (874.4 KiB)RX errors 0 dropped 0 overruns 0 frame 0TX packets 6728 bytes 886953 (866.1 KiB)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0ens33:0: flags4163UP,BROADCAST,RUNNING,MULTICAST mtu 1500inet 192.168.168.100 netmask 255.255.255.0 broadcast 192.168.168.255ether 00:0c:29:1a:74:34 txqueuelen 1000 (Ethernet)多个ip地址 server {listen 192.168.168.10:80;server_name www.xy102.com;charset utf-8;access_log logs/www.xy102.com.access.log;location / {root /var/www/html/xy102;index index.html index.htm;}location /xy103 {alias /opt/test1/xy103;index index.html;}error_page 500 502 503 504 /50x.html;location /50x.html {root html;}server {listen 192.168.168.100:80;server_name www.ly.com;charset utf-8;access_log logs/www.ly.com.access.log;#access_log logs/host.access.log main;location / {root /var/www/html/ly;index index.html index.htm;}error_page 500 502 503 504 /50x.html;location /50x.html {root html;}}测试结果 实验6基于端口实现多个虚拟主机 ifconfig ens33:0 192.168.168.100/24server {listen 192.168.168.10:80;server_name www.xy102.com;charset utf-8;access_log logs/www.xy102.com.access.log;location / {root /var/www/html/xy102;index index.html index.htm;}location /xy103 {alias /opt/test1/xy103;index index.html;}error_page 500 502 503 504 /50x.html;location /50x.html {root html;}server {listen 192.168.168.100:80;server_name www.ly.com;charset utf-8;access_log logs/www.ly.com.access.log;#access_log logs/host.access.log main;location / {root /var/www/html/ly;index index.html index.htm;}​ error_page 500 502 503 504 /50x.html; location /50x.html { ​ root html; }} [roottest1 nginx]# cd logs [roottest1 logs]# ls access.log error.log www.ly.com.access.log www.xy102.com.access.log实验7多个配置文件 vim nginx.confinclude /usr/local/nginx/conf.d/*.conf--------##可以识别到conf.d下只包含server模块的conf文件。把server单独放到一个文件当中去。不在nginx.conf文件当中。cd /usr/local/nginxmkdir conf.dvim test1.conf server {listen 8881;server_name localhost;charset utf-8;location /test1 {root /opt/conf;index index.html index.htm;} } server {listen 8882;server_name localhost;charset utf-8;location /test2 {root /opt/conf;index index.html index.htm;}} mkdir -p /opt/conf/test1 [roottest1 conf.d]# nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful [roottest1 conf.d]# mkdir -p /opt/conf/test1 [roottest1 conf.d]# echo wozhenshuai /opt/conf/test1/index.html [roottest1 conf.d]# [roottest1 conf.d]# mkdir -p /opt/conf/test2 [roottest1 conf.d]# echo wozhenchou /opt/conf/test2/index.html [roottest1 conf.d]# netstat -antp | grep nginx tcp 0 0 192.168.168.10:8080 0.0.0.0:* LISTEN 15027/nginx: master tcp 0 0 192.168.168.10:8081 0.0.0.0:* LISTEN 15027/nginx: master 实验8nginx优化与防盗链 [roottest1 conf.d]# curl -I 192.168.168.10:8881/test1/ HTTP/1.1 200 OK Server: nginx/1.22.0 Date: Tue, 02 Jul 2024 08:27:16 GMT Content-Type: text/html; charsetutf-8 Content-Length: 12 Last-Modified: Tue, 02 Jul 2024 08:02:36 GMT Connection: keep-alive ETag: 6683b41c-c Accept-Ranges: bytes[roottest1 conf]# vim nginx.confserver_tokens off;[roottest1 conf]# nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful [roottest1 conf]# systemctl restart nginx [roottest1 conf]# curl -I 192.168.168.10:8881/test1/ HTTP/1.1 200 OK Server: nginx Date: Tue, 02 Jul 2024 08:31:42 GMT Content-Type: text/html; charsetutf-8 Content-Length: 12 Last-Modified: Tue, 02 Jul 2024 08:02:36 GMT Connection: keep-alive ETag: 6683b41c-c Accept-Ranges: bytes隐藏版本号在/usr/local/nginx/conf/nginx.conf添加server_tokens off;基于第八个实验拓展 cd /opt/ [roottest1 opt]# ls aa conf jenkins-2.396-1.1.noarch.rpm nginx-1.22.0 nginx-1.22.0.tar.gz test [roottest1 opt]# cd nginx-1.22.0/ [roottest1 nginx-1.22.0]# ls auto CHANGES.ru configure html Makefile objs src CHANGES conf contrib LICENSE man README [roottest1 nginx-1.22.0]# cd src/ [roottest1 src]# ls core event http mail misc os stream [roottest1 src]# cd core/ [roottest1 core]# ls[roottest1 core]# vim nginx.h#define NGINX_VERSION wozhenshuai #define NGINX_VER nibiecai/ NGINX_VERSION[roottest1 core]# cd .. [roottest1 src]# cd .. [roottest1 nginx-1.22.0]# ./configure --prefix/usr/local/nginx --usernginx --groupnginx --with-http_stub_status_module[roottest1 nginx-1.22.0]# make -j 4 make installcd /usr/local/nginx/ [roottest1 nginx]# cd conf [roottest1 conf]# vim nginx.confserver_tokens on;[roottest1 conf]# nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful [roottest1 conf]# systemctl restart nginx[roottest1 conf]# curl -I 192.168.168.10:8881/test1/ HTTP/1.1 200 OK Server: nibiecai/wozhenshuai Date: Tue, 02 Jul 2024 08:49:31 GMT Content-Type: text/html; charsetutf-8 Content-Length: 12 Last-Modified: Tue, 02 Jul 2024 08:02:36 GMT Connection: keep-alive ETag: 6683b41c-c Accept-Ranges: bytes
http://www.dnsts.com.cn/news/136279.html

相关文章:

  • 做网站代理商网站没有备案怎么做淘宝客
  • 深圳外贸网站建设哪家好100个新公司起名
  • 无限成都成都市广播电视台官方网站做基础网站主机要
  • 西安网络技术有限公司网站扬中富裕吗
  • 建设网站的心得详情页设计与制作
  • 网站建设注意要求郑州网站权重
  • 阳泉建设局网站wordpress怎么设置首页
  • 广州建设银行网站首页广东同江医院网站建设
  • 网站制作赚钱吗网站过程中遇到问题
  • 宁德城乡住房建设厅网站沧州市网站优化排名
  • 做网站是如何赚钱的承德建设局网站
  • 软件下载网站哪个好形容网站开发的词
  • 做暧暖的免费网站05网寒假作业答案
  • 自已建网站卖东西要多少钱文山做网站yunling88
  • 网站建设 管理 会议纪要有什么好的书写网站
  • 陇南地网站建设wordpress自动审核
  • 三五互联网站报价表宁波英文网站建设
  • 国内做音乐网站wordpress固定地址
  • 做网站设计都需要什么新人做网络咨询的网站
  • 59网站一起做网店普宁山东个人网站备案
  • 网站flash导入页seo3
  • 深圳制作网站服务要看网海外域名是多少
  • 做店招的网站重庆做网站推广公司
  • 网站建设的缺点什么网站可以做电影投资
  • 黄冈网站推广平台邵东做网站的公司
  • 重庆网站备案查询系统网页qq空间登录
  • 自己也可以免费轻松创建一个网站常州网站建设方案外包
  • 哪里有做配音的兼职网站企业门户网站设计建设与维护
  • 如何看网站是否优化墨西哥网站后缀
  • 培训网站开发机构网站开发技术人员怎么接单