我有多个根以下nginx的配置(html/web
是默认,html/pma
是额外路线):nginx的多根配置问题
server {
listen 443 http2 ssl;
listen [::]:443 http2 ssl;
server_name website.com;
server_tokens off;
root /usr/share/nginx/html/web;
index index.php;
location/{
try_files $uri /index.php?$args;
}
location ^~ /pma {
root /usr/share/nginx/html;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
所以,在默认情况下/html/web/index.php
被打开,但是website.com/pma
打开/html/pma/
,其中pma
是PHPMyAdmin
。
的问题是:
PHPMyAdmin的认证形式重定向到index.php
。因此,当我写我的凭证时,它会将我重定向到/html/web/index.php
!但应该/html/pma/index.php
。即使从PHPMyAdmin注销也会重定向到/html/web/index.php
!
任何人都可以提出更好的配置方式吗?
我不使用PMA,但是您是否已将'PmaAbsoluteUri'设置为指向'/ pma /'?请参阅[此链接](https://docs.phpmyadmin.net/en/latest/config.html#basic-settings)。 –
将'index'移到'location'之外。 http://nginx.org/en/docs/http/ngx_http_index_module.html#index – Deadooshka
@Deadooshka没有帮助。编辑问题 – Leeloo