Ubuntu 14 – Nginx – PHP5-fpm:安装phpmyadmin但403禁止访问

Nginx和PHP5-FPM安装并运行良好……

#我可以访问http://www.example.comhttp://www.example.com/info.php

$ls -la /var/www/html
 -rw-r--r-- 1 root root  868 Nov  1 08:16 index.html
 -rw-r--r-- 1 root root   21 Nov  1 08:13 info.php

我安装了phpmyadmin并为phpmyadmin文件创建了一个符号链接

 lrwxrwxrwx 1 root root   21 Nov  1 08:37 phpmyadmin -> /usr/share/phpmyadmin

但试图得到http://www.example.com/phpmyadmin =>我得到了一个403 Forbidden

使用符号链接,我不应该将与phpmyadmin相关的任何内容添加到我的nginx.conf中……可能会丢失什么?

更新1:将index.php添加到uri会带来登录面板

 http://www.example.com/phpmyadmin/index.php

我应该添加到我的默认con文件中直接获取它…我想我的try文件无效..
这是我的默认nginx站点con文件

    server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /var/www/html;
        index index.php, index.html index.htm;

        server_name example.com;

        location / {
            try_files $uri $uri/ index.html index.php  =404;
        }

        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
            root /var/www/html;
        }

        location ~ \.php${
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        }
    }
添加以下位置后运行正常:

     location /phpmyadmin {
       index index.php;
    }

转载注明原文:Ubuntu 14 – Nginx – PHP5-fpm:安装phpmyadmin但403禁止访问 - 代码日志