我的nginx配置有问题。我服务器中的结构目录是:
我的/ etc / nginx / sites-available / default
server{
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
access_log /var/www/log/access.log;
error_log /var/www/log/error.log;
root /var/www/public_html;
index index.php index.htm;
# Make site accessible from http://localhost/
server_name localhost;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location /pma/ {
index index.php;
alias /var/www/phpmyadmin/;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort off;
}
}
location /vma/ {
index index.php;
alias /var/www/vimbadmin/public/;
try_files $uri $uri/ /index.php?$args;
index index.php;
location ~\.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#try_files $uri =404;
include fastcgi_params;
}
}
}
现在,当我去的时候:domian.com/vma/将我重定向到domian.com/vma/auth/login,我看到了:
找不到档案。
Phpmyadmin的作品。 我知道配置不好......但错误在哪里?
答案 0 :(得分:0)
我做了类似的事
location ~ ^/vma {
alias /usr/local/vimbadmin/public;
location ~ ^/vma/(.*\.(js|css|gif|jpg|png|ico))$ {
alias /usr/local/vimbadmin/public/$1;
}
rewrite ^/vma(.*)$ /vma/index.php last;
location ~ ^/vma(.+\.php)$ {
alias /usr/local/vimbadmin/public$1;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
charset utf8;
include fastcgi_params;
fastcgi_param DOCUMENT_ROOT /usr/local/vimbadmin/public;
}
}
它起作用,至少在我的机器上;)
答案 1 :(得分:0)
使用ViMbAdmin V3.0.11,ir1keren的答案对我不起作用。
我是这样做的:
#
# ViMbAdmin 3.0.x Nginx configuration
# Directory where ViMbAdmin is installed
set $vimbadmin /var/www/vimbadmin;
location /vma {
alias $vimbadmin/public;
index index.php index.html index.htm;
location ~ ^/vma/(.*\.(js|css|gif|jpg|png|ico))$ {
alias $vimbadmin/public/$1;
}
rewrite ^/vma(.*)$ /mail/index.php last;
# Pass PHP scripts to FastCGI server
location ~ \.php$ {
#try_files $uri =404;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
fastcgi_split_path_info ^/vma/(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param APPLICATION_ENV production;
fastcgi_index index.php;
fastcgi_pass php-backend;
fastcgi_intercept_errors on;
}
}