我有我的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找不到,任何帮助都会让人感到高兴谢谢
答案 0 :(得分: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;
}
}
答案 1 :(得分:2)
以下工作和测试
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中获得,但是到了下面,它就像一个魅力 将这两个地方的'pma'改为你想要的任何东西,它会起作用......不需要sym链接
欢呼声
答案 2 :(得分: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;
}
}
答案 3 :(得分:1)
在这种情况下,您需要使用alias
。
location /secure/ {
alias /usr/share/phpmyadmin/;
通过以上设置,/secure/
的所有请求都将被删除至/usr/share/phpmyadmin/
。