国产探花免费观看_亚洲丰满少妇自慰呻吟_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 m.survivalescaperooms.com vevb.com;    access_log /data/logs/nginx/m.survivalescaperooms.com.access.log main;     index index.html index.php;    root /data/site/m.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



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 金华市| 江阴市| 临海市| 健康| 偏关县| 浮山县| 南阳市| 垣曲县| 尤溪县| 宝丰县| 芦山县| 罗甸县| 咸阳市| 宿迁市| 永嘉县| 出国| 安康市| 永昌县| 西乌珠穆沁旗| 扎鲁特旗| 鄂托克旗| 罗山县| SHOW| 咸丰县| 体育| 赣州市| 隆昌县| 尉犁县| 临清市| 太湖县| 屏南县| 麻城市| 铜山县| 家居| 张家界市| 二连浩特市| 宽城| 杭锦旗| 贡觉县| 元朗区| 蓬溪县|