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

手机制作app需要什么软件天津seo

手机制作app需要什么软件,天津seo,html5网站制作工具,常州专业做网站nginx测试rewrite last :相当于 Apache 里的(L)标记,表示完成rewrite 匹配; break: 本条规则匹配完成后,终止匹配,不再匹配后面的规则。 # 其中last 和 break 用来实现 URL 重写时,浏览器地址栏URL 地址不变 redirect: 返回 302 …

nginx测试rewrite

last :相当于 Apache 里的(L)标记,表示完成rewrite 匹配;
break: 本条规则匹配完成后,终止匹配,不再匹配后面的规则。
# 其中last 和 break 用来实现 URL 重写时,浏览器地址栏URL 地址不变
redirect: 返回 302 临时重定向,浏览器地址会显示跳转后的 URL 地址。
permanent: 返回 301永久重定向,浏览器地址栏会显示跳转后的URL 地址
#不配置将显示304
[root@node1 ~]# yum -y install gcc make pcre-devel openssl-devel
[root@node1 ~]# tar xf nginx-1.22.1.tar.gz
[root@node1 ~]# cd nginx-1.22.1/
[root@node1 nginx-1.22.1]# ./configure  --prefix=/usr/local/nginx  --user=nginx  --with-http_ssl_module
[root@node1 nginx-1.22.1]#  make && make install
[root@node1 nginx-1.22.1]# useradd nginx -s /sbin/nologin
[root@node1 nginx-1.22.1]# /usr/local/nginx/sbin/nginx
[root@node1 nginx-1.22.1]# cd /usr/local/nginx/
[root@node1 nginx]# mkdir html/static
[root@node1 nginx]# echo "html/static/index.html">html/static/index.html
[root@node1 nginx]# echo "html/static/node1.html">html/static/node1.html#访问显示
http://www.myweb.com/static/ -->  html/static/index.html
http://www.myweb.com/static/test.html -->  html/static/test.html
http://www.myweb.com/forum.php -->  404 Not Found

last :相当于 Apache 里的L)标记,表示完成rewrite 匹配;

break: 本条规则匹配完成后,终止匹配,不再匹配后面的规则。

redirect: 返回 302 临时重定向,浏览器地址会显示跳转后的URL 地址。

permanent: 返回301永久重定向,浏览器地址栏会显示跳转后的 URL 地址。

其中 last 和 break 用来实现 URL 重写时,浏览器地址栏URL 地址不变。

#访问  http://www.myweb.com/forum.php  -跳转->  html/static/test.htmlserver {listen       80;server_name www.myweb.com;# 本地目录重写# 状态码304 地址栏不变化  http://www.myweb.com/forum.phprewrite ^/forum.php$ /static/node1.html last;  # 状态码304 地址栏不变化  http://www.myweb.com/forum.phprewrite ^/forum.php$ /static/node1.html break;  # 状态码301 地址栏变为http://www.myweb.com/static/test.htmlrewrite ^/forum.php$ /static/test.html permanent;# 状态码302 地址栏变为http://www.myweb.com/static/test.htmlrewrite ^/forum.php$ http://www.myweb.com/static/test.html last;#本站 url跳转  url地址栏变化, last、break、redirect都是302# 状态码302 地址栏变为http://www.myweb.com/static/test.htmlrewrite ^/forum.php$ http://www.myweb.com/static/test.html last;#forum.php状态码301 地址栏变为http://www.myweb.com/static/test.htmlrewrite ^/forum.php$ http://www.myweb.com/static/test.html permanent;# 跳百度# forum.php状态码302 地址栏变为 http://www.baidu.comrewrite ^/forum.php$ http://www.baidu.com break; # last、redirect也是302#forum.php状态码301 地址栏变为 http://www.baidu.comrewrite ^/forum.php$ http://www.baidu.com permanent;location / {...浏览器Disable cache 访问
    location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css)$ {root html; # 绝对路径也可以完成访问   /usr/local/nginx/html;}

[root@node1 baidu]# wget -r -x http://fjxplz.com/1004.html[root@node1 html] mkdir weihu
[root@node1 html]# echo   "维护中...">weihu/index.html#  http://www.myweb.com   维护
server {listen       80;server_name www.myweb.com;# 3、最终还是跳到维护页面rewrite ^/forum.php$ http://www.myweb.com/static/test.html permanent  ;# 2、加了rewrite后跳转,跟下面的location的上下顺序影响rewrite ^/(.*)$ /weihu/index.html last;  # 所有页都跳维护页rewrite ^/$ /weihu/index.html last;   # 根页跳到维护页#rewrite ^/(.*)$ /weihu/index.html last;# 1、不加上面的rewrite时,默认首页 location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css)$ {#    location / {   与上面一样root html; # 绝对路径也可以完成访问   /usr/local/nginx/html;}        # 3、最终还是跳到维护页面http://www.myweb.com/forum.php--》static  --》2 /weihu/
192.168.1.11 - -  "GET /forum.php HTTP/1.1" 301 169 "-" "Wget/1.14 (linux-gnu)"
192.168.1.11 - -  "GET /static/test.html HTTP/1.1" 200 13 "-" "Wget/1.14 (linux-gnu)"
server {listen       80;server_name www.myweb.com;# 一直会301跳转,看日志或者wget看下过程rewrite ^/(.*)$ /weihu/index.html permanent;  # wget下或者看日志# 传递参数rewrite ^/(.*)$  http://www.baidu.com/$1 permanent;# myweb.com 跳转到baiduif ($host = 'myweb.com') {rewrite ^/(.*)$  http://www.myweb.com/$1 permanent;}

wget 查看

[root@node1 conf]# wget myweb.com
--2023-10-21 17:32:25--  http://myweb.com/
Resolving myweb.com (myweb.com)... 192.168.1.11
Connecting to myweb.com (myweb.com)|192.168.1.11|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently  # permanent
Location: http://www.myweb.com/ [following]
--2023-10-21 17:32:25--  http://www.myweb.com/	# 跳转后的 
Resolving www.myweb.com (www.myweb.com)... 192.168.1.11
Reusing existing connection to myweb.com:80.
HTTP request sent, awaiting response... 200 OK
Length: 13 [text/html]
Saving to: ‘index.html.2’# myweb.com 跳转到www.myweb.comif ($host = 'myweb.com') {rewrite ^/(.*)$  http://www.myweb.com/$1 last; # last不是上面的permanent}
[root@node1 conf]# wget myweb.com
--2023-10-21 17:30:57--  http://myweb.com/
Resolving myweb.com (myweb.com)... 192.168.1.11
Connecting to myweb.com (myweb.com)|192.168.1.11|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily #302  last
Location: http://www.myweb.com/ [following]
--2023-10-21 17:30:57--  http://www.myweb.com/	# 跳转后的   
Resolving www.myweb.com (www.myweb.com)... 192.168.1.11
Reusing existing connection to myweb.com:80.
HTTP request sent, awaiting response... 200 OK
Length: 13 [text/html]
Saving to: ‘index.html.1’

多种域名跳转

# 多种域名跳转if ($host != 'myweb.com'){rewrite ^/(.*)s http://www.myweb.com/$1 permanent;}
# 不存在的页面跳转    if ( !-e $request_filename){rewrite ^/(.*)$ /weihu/index.html last;}# 火狐浏览器跳转   if ($http_user_agent ~ firefox) { rewrite  ^/index.html$  /firefox/index.html;}

Nginx:Rewrite跳转+正则表达式+6个生产案列!内容过于真实

https://blog.csdn.net/weixin_48190891/article/details/108532802

Nginx rewrite常用全局变量详细介绍

https://blog.csdn.net/Blue92120/article/details/129003292

upstream lmsManagerAuth-backend {
server 7.180.171.42:8100 max_fails=3 fail_timeout=10s;
}location ~ ^/edx/lmsManagerAuth/api/datacenter/.*{rewrite /edx/lmsManagerAuth/(.*)  /$1 break;  #截取保留重写为api/datacenter/.*proxy_pass http://lmsManagerAuth-backend;
www.myweb.com.zh		www.myweb.com/zh
www.myweb.com.en		www.myweb.com/en在原来的配置文件/usr/local/nginx/conf/nginx.conf的http{}内末尾处加一句:
include /usr/local/nginx/conf.d/*.conf;[root@node1 nginx]# mkdir -p /usr/local/nginx/conf.d/
[root@node1 nginx]# vim conf.d/www.myng.com.conf
server {listen 80;server_name www.myng.com;location / {root /code;index index.html;
}
[root@node1 nginx]# mkdir -p /code/{zh,en}[root@node1 nginx]# echo  zh>/code/zh/index.html
[root@node1 nginx]# echo  en>/code/en/index.html
[root@node1 nginx]# echo code>/code/index.html
[root@node1 html]# curl  www.myng.com
code
[root@node1 html]# curl  www.myng.com/en/
en
[root@node1 html]# curl  www.myng.com/zh/   #浏览器里默认加/ 
zhserver {listen 80;server_name www.myng.com.zh  www.myng.com.en;root /code;index index.html;location / {if ($http_host ~* 'zh'){   #$http_host 请求的host的#$http_accept_language  浏览器请求头里的语言标识#$http_user_agent  ~* "iphone|ipad|androaid"   基于agentset $language zh;}if ($http_host ~* 'en'){set $language en;}  rewrite ^/$ http://www.myng.com/$language redirect;}
http://www.myng.com.zh/     --跳转-->  http://www.myng.com/zh/

curl -Lv

[root@node1 html]# curl -Lv  www.myng.com.zh    #会自动重定向后边指定的网址
* About to connect() to www.myng.com.zh port 80 (#0)
*   Trying 192.168.1.11...
* Connected to www.myng.com.zh (192.168.1.11) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: www.myng.com.zh
> Accept: */*
>
< HTTP/1.1 302 Moved Temporarily
< Server: nginx/1.22.1
< Date: Sun, 22 Oct 2023 12:53:43 GMT
< Content-Type: text/html
< Content-Length: 145
< Connection: keep-alive
< Location: http://www.myng.com/zh
<
* Ignoring the response-body
* Connection #0 to host www.myng.com.zh left intact
* Issue another request to this URL: 'http://www.myng.com/zh'
* About to connect() to www.myng.com port 80 (#1)
*   Trying 192.168.1.11...
* Connected to www.myng.com (192.168.1.11) port 80 (#1)
> GET /zh HTTP/1.1
> User-Agent: curl/7.29.0
> Host: www.myng.com
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Server: nginx/1.22.1
< Date: Sun, 22 Oct 2023 12:53:43 GMT
< Content-Type: text/html
< Content-Length: 169
< Location: http://www.myng.com/zh/
< Connection: keep-alive
<
* Ignoring the response-body
* Connection #1 to host www.myng.com left intact
* Issue another request to this URL: 'http://www.myng.com/zh/'
* Found bundle for host www.myng.com: 0x2014450
* Re-using existing connection! (#1) with host www.myng.com
* Connected to www.myng.com (192.168.1.11) port 80 (#1)
> GET /zh/ HTTP/1.1
> User-Agent: curl/7.29.0
> Host: www.myng.com
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx/1.22.1
< Date: Sun, 22 Oct 2023 12:53:43 GMT
< Content-Type: text/html
< Content-Length: 3
< Last-Modified: Sun, 22 Oct 2023 11:48:01 GMT
< Connection: keep-alive
< ETag: "65350bf1-3"
< Accept-Ranges: bytes
<
zh
* Connection #1 to host www.myng.com left intact
# 不加-L选项的
[root@node1 html]# curl -v  www.myng.com.zh
* About to connect() to www.myng.com.zh port 80 (#0)
*   Trying 192.168.1.11...
* Connected to www.myng.com.zh (192.168.1.11) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: www.myng.com.zh
> Accept: */*
>
< HTTP/1.1 302 Moved Temporarily
< Server: nginx/1.22.1
< Date: Sun, 22 Oct 2023 12:54:30 GMT
< Content-Type: text/html
< Content-Length: 145
< Connection: keep-alive
< Location: http://www.myng.com/zh
<
<html>
<head><title>302 Found</title></head>
<body>
<center><h1>302 Found</h1></center>
<hr><center>nginx/1.22.1</center>
</body>
</html>
* Connection #0 to host www.myng.com.zh left intact

根据浏览器,agent跳转

server {listen 80;server_name www.myng.com.zh  www.myng.com.en;root /code;index index.html;location / {
#场景1: 根据用户浏览器的语言,自动跳转至不同的页面。	if ($http_accept_language ~* 'zh'){   set $language zh;}if ($http_accept_language ~* 'en'){set $language en;}  rewrite ^/$ http://www.myng.com/$language redirect;}#2: 根据用户来源终端设备跳转至不同站点或不同域名if ($http_user_agent  ~* "iphone|ipad|androaid"){rewrite ^/$ http://www.myng.com/m;}#3:传递跳转的uriif ($http_user_agent  ~* "iphone|ipad|androaid"){return 302 http://www.myng.com$request_uri;  #将uri传递}

api地址跳转

#api.myng.com/bbb   www.myng.com/api/bbbserver {listen 80;server_name api.myng.com;if ($http_host ~* (.*)\.(.*)\.(.*)){set $domain $1;}rewrite ^/(.*)$  http://www.myng.com/$domain/$1 last;
}

维护页面

server {listen 80;server_name www.myng.com.zh  www.myng.com.en;root /code;rewrite ^/(.*)$ /wh.html break; #放在server下location / {...

根据状态码跳转

server {listen 80;server_name www.myng.com;root /code;index index.html;
...    error_page   500 502 503 504  =@temp;location @temp {root /data/errorrewrite ^/(.*)$ /wh.html break; #放在server下	}

根据ip区分用户

server {listen 80;server_name www.myng.com;root /code;set $ip 0;if ($remote_addr ~ "10.0.0.1") { #X-Forwarded-For代理ipset $ip 1;}if  ($ip=0){rewrite  ^/(.*)$ /wh.html break; #放在server下}

return 返回跳转

需求: 如果用户请求www.myng.com/test,则返回至ww.xuliangwei.com的urlserver {listen 80;server_name www.myng.com;location / {default_type text/html;# 需要设置--》识别返回字符串if ($request_uri  ~* '^/test'){return 200 "return test";#return 302 http://www.baidu.com;   #302跳转到百度}root /code;index index.html;}
}#浏览器访问:返回
http://www.myng.com/test     return test

last break

当rewrite规则遇到break后,本locationf与其他ocation的所有rewrite/return规则都不再执行。
当rewrite规则遇到last后,本locationh里后续rewrite/return规则不执行,但重写后的url再次从头开始执行所有规则,哪个匹配执行哪个

server {listen 80;server_name www.myng.com;root /code;location / {#http://www.myng.com/1.html    b.htmlrewrite /1.html /2.html;#http://www.myng.com/1.html    2.html#rewrite /1.html /2.html break; #break终止,不再匹配#http://www.myng.com/1.html    a.html #rewrite /1.html /2.html last; #last终止当前location的匹配rewrite /2.html /3.html;}location /2.html {rewrite /2.html /a.html;}location /3.html {rewrite /3.html /b.html;}
}[root@node1 nginx]# echo 1.html>/code/1.html
[root@node1 nginx]# echo 2.html>/code/2.html
[root@node1 nginx]# echo 3.html>/code/3.html
[root@node1 nginx]# echo a.html>/code/a.html
[root@node1 nginx]# echo b.html>/code/b.html
http://www.shuangfujiaoyu.com/news/31280.html

相关文章:

  • 设计优秀的企业网站今日热搜榜排名最新
  • 网站的外部推广中国万网域名注册免费
  • 自己做的网站怎么加入微信支付seo外包公司一般费用是多少
  • 安徽网站备案要多少时间北京网站制作设计
  • 深圳装饰公司网站培训网址大全
  • 做平面设计一般上哪个网站参考现在有什么技能培训班
  • 图书馆 网站建设优化网站关键词优化
  • asp动态网站开发实训教程智能建站abc
  • windows下搭建wordpress青岛seo网站推广
  • 做盗版网站的广州新闻发布
  • 建筑公司企业宣传册清远seo
  • 免费做数据采集的网站百度站长工具网站提交
  • 广州比较好的网站建设哪家好系统优化app最新版
  • 建筑企业招聘网站万州网站建设
  • 黑客网站免费网站武汉网络推广公司排名
  • 做刷单的网站域名站长工具
  • 视频类网站如何做缓存免费的关键词挖掘工具
  • 建德网站宁波企业网站seo
  • 西宁个人网站建设淘宝怎么提高关键词搜索排名
  • 天津网站营销seo电话西安抖音seo
  • 网页网站怎么做的新闻今天
  • 设计师都上什么网站搜索引擎优化规则
  • 做课件最好的素材网站网站制作费用多少
  • 做百度手机网站优化快seo排名优化软件有
  • 做ppt好的模板下载网站有哪些it培训机构靠谱吗
  • 提高网站权重实时新闻
  • 外贸b2c平台都有哪些网站企业网络营销策略案例
  • 网站程序开发要点营销推广策略
  • 烟台莱州网站建设云南网络营销公司哪家好
  • 何苦做游戏网站北京网站建设开发公司