Drupal nginx重写规则

凉白开 Nginx1 9,737字数 526阅读1分45秒阅读模式

Drupal nginx重写规则如下:

 文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-configuration-for-drupal/

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;
 }
...
 }

 文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-configuration-for-drupal/

重启nginx文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-configuration-for-drupal/ 文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-configuration-for-drupal/

weinxin
我的微信
微信公众号
扫一扫关注运维生存时间公众号,获取最新技术文章~
凉白开
  • 本文由 发表于 31/08/2014 01:00:09
  • 转载请务必保留本文链接:https://www.ttlsa.com/nginx/nginx-configuration-for-drupal/
评论  1  访客  1
    • Aceslup
      Aceslup 9

      try_files 的用法还真的不太会用。继续学习。

    评论已关闭!