一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務器之家:專注于服務器技術及軟件下載分享
分類導航

云服務器|WEB服務器|FTP服務器|郵件服務器|虛擬主機|服務器安全|DNS服務器|服務器知識|Nginx|IIS|Tomcat|

服務器之家 - 服務器技術 - Nginx - WordPress與Drupal的Nginx配置rewrite重寫規則示例

WordPress與Drupal的Nginx配置rewrite重寫規則示例

2019-11-07 14:58goldensun Nginx

這篇文章主要介紹了WordPress與Drupal的Nginx配置重寫規則示例,文中介紹的rewrite寫法簡單而突出配置重點,需要的朋友可以參考下

WordPress

wordpress依然是目前是世界上最流行的博客系統,越來越多由wordpress搭建而成的網站在使用nginx服務器軟件,這里就來分享一下WordPress的nginx重寫規則:
 

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  server {
    listen    80;
    server_name www.ythuaji.com.cn zzvips.com;
    access_log /data/logs/nginx/www.ythuaji.com.cn.access.log main;
 
    index index.html index.php;
    root /data/site/www.ythuaji.com.cn;
location / {
    try_files $uri $uri/ /index.php?$args;
    add_header Pragma "public";
    expires 12h;
}
 
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
 
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
    access_log off;
      log_not_found off;
      expires max;
}
 
 
location ~ \.php$ {
    try_files $uri =404;
 
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
 
    include fastcgi_params;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#    fastcgi_intercept_errors on;
    fastcgi_pass 127.0.0.1:9000;
}
 
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
    expires 24h;
    access_log off;
}
 
location ~ .*\.(js|css)$
{
    expires 24h;
    access_log off;
}

 重啟你的nginx即可

 

Drupal nginx重寫規則
Drupal是使用PHP語言編寫的開源內容管理框架,就是俗稱的CMS,很多人在用Drupal搭建自己的博客,這里也來分享一下Drupal的nginx重寫規則:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
server {
 ...
location / {
 # This is cool because no php is touched for static content
 try_files $uri @rewrite;
 }
location @rewrite {
 # Some modules enforce no slash (/) at the end of the URL
 # Else this rewrite block wouldn't be needed (GlobalRedirect)
 rewrite ^/(.*)$ /index.php?q=$1;
 }
location ~ \.php$ {
 fastcgi_split_path_info ^(.+\.php)(/.+)$;
 #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
 include fastcgi_params;
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 fastcgi_intercept_errors on;
 fastcgi_pass unix:/tmp/phpfpm.sock;
 }
...
 }

 
重啟nginx

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 亚洲激情在线视频 | 91对白在线 | 亚洲乱码一二三四五六区 | 驯服有夫之妇HD中字日本 | 国产区综合另类亚洲欧美 | 国内精品免费一区二区三区 | 欧美一级特黄特色大片 | 无遮掩60分钟从头啪到尾 | 色老板在线播放 | 免费观看一区二区 | 楚乔传第二部全60集免费观看 | 国产精品久久久久久久久免费观看 | 成人精品视频一区二区在线 | 国产经典一区二区三区蜜芽 | 天干夜天天夜天干天ww | 欧美综合国产精品日韩一 | 人阁色第四影院在线观看 | 国产精品毛片久久久久久久 | 久久国产精品福利影集 | 91制片厂果冻星空传媒3xg | 日本在线观看视频网站 | 国产成人免费 | ts人妖国产一区 | 好大夫在线个人空间 | 精品久久久久久久久久香蕉 | 亚洲成人贴图 | 毛片资源站 | 欧美一区二区三区免费看 | 免费高清资源黄网站在线观看 | 日本人做受全过程视频 | 国产欧美久久久精品影院 | 国产成人精品在线观看 | 日韩妹妹 | bl文全肉高h湿被灌尿 | 男人机机桶女人机机 | 欧美高清在线精品一区二区不卡 | 久草大 | 国产精品久久久久这里只有精品 | 欧美第一视频 | 久久国产精品永久免费网站 | 香蕉人人超人人超碰超国产 |