Piwigo伪静态设置

lisahost.com

Piwigo,相当不错的图库应用,基于PHP 和 Mysql。下面是Piwigo nginx 的伪静态设置。

一、Piwigo nginx rewrite 伪静态设置
1、Piwigo后台,安装并启用插件LocalFiles Editor

加入:

$conf['php_extension_in_urls'] = false;
$conf['question_mark_in_urls'] = false;

piwigo.png

2、伪静态规则

location / {
    index index.php;
    try_files $uri $uri/ @rewrite;
}
location @rewrite {
   rewrite ^/picture((/|$).*)$ /picture.php$1 last;
   rewrite ^/index((/|$).*)$ /index.php$1 last;
   rewrite ^/i((/|$).*)$ /i.php$1 last;
   # for piwigo-openstreetmap
   rewrite ^/osmmap((/|$).*)$ /osmmap.php$1 last;
}
location ~ ^(?P.+\.php)(?P/.*)$ {
  try_files $script_name =404;
  include fastcgi_params;
  fastcgi_param SCRIPT_FILENAME $document_root$script_name;
  fastcgi_param PATH_INFO $path_info;
  fastcgi_param PATH_TRANSLATED $document_root$path_info;
  fastcgi_pass 127.0.0.1:9000;
}

二、Piwigo Apache伪静态设置
1、Piwigo后台,安装并启用插件LocalFiles Editor

加入:

$conf['question_mark_in_urls'] = false;
$conf['php_extension_in_urls'] = false;
$conf['category_url_style'] = 'id-name';
$conf['picture_url_style'] = 'file';

2、.htaccess 内容

#htaccess piwigo
AcceptPathInfo On
RewriteEngine On
RewriteCond %{REQUEST_URI} !.+php*
RewriteCond %{DOCUMENT_ROOT}/$1\.php -f
RewriteRule ^([^/]+)/?(.*)$ $1.php/$2 [L]
    所有主机信息仅是为及时分享并收录,不做推荐!