国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > Nginx > 正文

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

2024-08-30 12:27:58
字體:
來源:轉載
供稿:網友
這篇文章主要介紹了WordPress與Drupal的Nginx配置重寫規則示例,文中介紹的rewrite寫法簡單而突出配置重點,需要的朋友可以參考下
 

WordPress

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

  server {    listen    80;    server_name www.survivalescaperooms.com vevb.com;    access_log /data/logs/nginx/www.survivalescaperooms.com.access.log main;     index index.html index.php;    root /data/site/www.survivalescaperooms.com;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重寫規則:

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



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 张家界市| 九江县| 揭东县| 延安市| 澳门| 新宾| 临漳县| 青阳县| 乌兰浩特市| 千阳县| 诸暨市| 惠来县| 苍溪县| 乌拉特中旗| 达日县| 耿马| 巴林右旗| 天祝| 什邡市| 贵州省| 万载县| 育儿| 丹东市| 维西| 巴林左旗| 隆德县| 平顺县| 赣州市| 尖扎县| 武乡县| 乾安县| 盱眙县| 咸宁市| 康马县| 镇原县| 邻水| 孝义市| 尉氏县| 石景山区| 思茅市| 东丽区|