无法使用debian下的nginx访问phpmyadmin“没有指定input文件”。

我已经安装了Nginx,php-fpm,mysql和phpmyadmin ..

当我inputmyserver.com时,我看到“Welcome to nginx!”。

但是当我键入myserver.com/phpmyadmin时,我得到:“没有指定input文件”。 我知道这可能是path上的一个问题,但我找不到在哪里…:S

configuration文件:

在/ etc / nginx的/网站可用/默认

server { listen 80; ## listen for ipv4; this line is default and implied listen [::]:80 default_server ipv6only=on; ## listen for ipv6 root /usr/share/nginx/www; index index.php index.html index.htm; # Make site accessible from http://localhost/ server_name _; location / { try_files $uri $uri/ /index.html; } location /doc/ { alias /usr/share/doc/; autoindex on; allow 127.0.0.1; allow ::1; deny all; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; #fastcgi_pass 127.0.0.1:9000; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } } 

/etc/nginx/sites-availables/www.myserver.com.vhost

 server { listen 80; server_name www.server.com server.com; root /usr/share/nginx/www.akdom.net; if ($http_host != "www.akdom.net") { rewrite ^ http://www.akdom.net$request_uri permanent; } index index.php index.html; location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } # Make sure files with the following extensions do not get loaded by nginx because nginx would display the s$ location ~* \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..$ deny all; } # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac). location ~ /\. { deny all; access_log off; log_not_found off; } location ~* \.(jpg|jpeg|png|gif|css|js|ico)$ { expires max; log_not_found off; } location ~ \.php$ { try_files $uri =404; include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } 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; } } 

/ usr / share /我有phpmyadmin /,nginx / www /和nginx / www.exemple.com /

如何解决这个错误? 是什么造成的?

谢谢你的时间。

在文件/etc/nginx/sites-availables/www.myserver.com.vhost

更改行root /usr/share/; 内部位置/ phpmyadmin到: root /usr/share/phpmyadmin/;

你在这里是位置select规则的受害者。

为了得到这个工作,你需要使你的位置/ phpmyadmin比location〜.php $更优先。 要做到这一点,我们必须考虑文件中有关位置的说法 。

基本上比正则expression式位置更具体的唯一位置是精确匹配=和负面正则expression式位置^〜

精确的匹配在这里不是一个好的select,所以我们需要使用负面的正则expression式位置。

  location ^~ /phpmyadmin { root /usr/share; index index.php index.html index.htm; location ~ \.php$ { try_files $uri =404; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /etc/nginx/fastcgi_params; } location ~* \.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ { root /usr/share; # If you're only setting root then this is not needed. } location ~ /\. { # We need to duplicate this so that we don't serve htaccess/passwd files for this subdir. deny all; access_log off; log_not_found off; } }