3

我有我的 phpmyadmin 设置

 location /phpmyadmin {
               root /usr/share/;
               index index.php index.html index.htm;
               location ~ ^/phpmyadmin/(.+\.php)$ {
                       try_files $uri =404;
                       root /usr/share/;
                       fastcgi_pass 127.0.0.1:9000;
                       fastcgi_index index.php;
                       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                       include /etc/nginx/fastcgi_params;
               }
               location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                       root /usr/share/;
               }
        }
        location /phpMyAdmin {
               rewrite ^/* /phpmyadmin last;
        }

我正在寻找更改文件夹名称,以便我可以通过 /secure 访问 phpmyadmin

 location /secure {
               root /usr/share/;
               index index.php index.html index.htm;
               location ~ ^/secure/(.+\.php)$ {
                       try_files $uri =404;
                       root /usr/share/;
                       fastcgi_pass 127.0.0.1:9000;
                       fastcgi_index index.php;
                       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                       include /etc/nginx/fastcgi_params;
               }
               location ~* ^/secure/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                       root /usr/share/;
               }
        }

但它一直给我 404 未找到,任何帮助将不胜感激,谢谢

4

4 回答 4

3

以下工作和测试

location /pma/ {
    alias /usr/share/phpmyadmin/;
}

location ~ ^/pma/(.+\.php)$ {
    alias /usr/share/phpmyadmin/$1;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $request_filename;

    # From fastcgi_params
    include fastcgi_params;
    fastcgi_param  DOCUMENT_ROOT      /usr/share/phpmyadmin;
}

关键是设置如下

fastcgi_param  DOCUMENT_ROOT      /usr/share/phpmyadmin;

这是一个在 fastcgi_params 中获取 se 的变量,但是当它低于它时,它就像一个魅力,将两个地方的“pma”更改为你想要的任何东西,它会起作用......不需要符号链接

干杯

于 2013-04-12T10:09:04.973 回答
2

尝试这个:

location /secure {
    alias /usr/share/phpmyadmin;
    index index.php index.html index.htm;

    location ~ ^/secure/(.+\.php)$ {
        alias /usr/share/phpmyadmin/$1;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;

        include fastcgi_params;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin/$1;
        fastcgi_pass php;
    }

    location ~* ^/secure/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
        alias /usr/share/phpmyadmin/$1;
    }
}
于 2013-07-21T05:34:26.643 回答
2

像这样的东西应该工作。

location /secure/ {
    alias /usr/share/phpmyadmin/;

    location ~ ^/secure/(.+\.php)$ {
        alias /usr/share/phpmyadmin/$1;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
    }
}
于 2013-04-12T09:39:55.780 回答
1

你需要alias在这种情况下使用。

location /secure/ {
           alias /usr/share/phpmyadmin/;

使用上述设置,所有请求都/secure/将被丢弃到/usr/share/phpmyadmin/.

于 2013-04-12T08:24:22.417 回答