我想让example.com/PHPmyadmin从我的网站路由到不同的目录,这样我就可以为我的所有网站使用一个通用的PHPmyadmin安装.我试过这个:
server {
listen 80;
server_name example.com;
location / {
root /home/web/example.com/public_html;
index index.html index.htm index.PHP;
}
location ~ \.PHP${
root /home/web/example.com/public_html;
if ($request_uri ~* /PHPmyadmin) {
root /home/web/PHPmyadmin;
}
try_files $uri =404;
fastcgi_pass unix:/tmp/PHP5-fpm.sock;
fastcgi_index index.PHP;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
这似乎根本不起作用.
我也试过这个:
server {
listen 80;
server_name example.com;
location / {
root /home/web/example.com/public_html;
index index.html index.htm index.PHP;
}
location /PHPmyadmin {
root /home/web/PHPmyadmin;
index index.html index.htm index.PHP;
}
location ~ \.PHP${
root /home/web/example.com/public_html;
try_files $uri =404;
fastcgi_pass unix:/tmp/PHP5-fpm.sock;
fastcgi_index index.PHP;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
2013/06/28 01:10:47 [error] 7068#0: *1 "/home/web/PHPmyadmin/PHPmyadmin/index.html" is not found (2: No such file or directory)
所以在位置块中我将root更改为/ home / web,认为它将取出额外的PHPmyadmin,但是,相反,我在错误日志中根本没有得到关于PHPmyadmin的任何信息.我似乎无法弄清楚正确的配置以及为什么这个配置不起作用.有任何想法吗?
解决方法:
在ubuntu服务器上,我使用以下设置在/ pma下为几个Nginx站点提供PHPMyAdmin.
/etc/PHPmyadmin/Nginx-PHP5-fpm.conf
location /pma {
alias /usr/share/PHPmyadmin/;
}
location ~ ^/pma/(.*\.(js|css|gif|jpg|png))${
alias /usr/share/PHPmyadmin/$1;
}
location ~ ^/pma(.+\.PHP)${
alias /usr/share/PHPmyadmin$1;
fastcgi_pass unix:/var/run/PHP-fpm.sock;
fastcgi_index index.PHP;
charset utf8;
include fastcgi_params;
fastcgi_param DOCUMENT_ROOT /usr/share/PHPmyadmin;
}
然后在任何/ etc / Nginx / sites-available / *中我可以使用以下行启用pma支持:
include /etc/PHPmyadmin/Nginx-PHP5-fpm.conf;
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。