Think before you speak, read before you think.

nginx使用phpmyadmin及配置

要求:在nginx环境下,打开服务器的http://ip/phpmyadmin或http://域名/phpmyadmin都能够使用phpmyadmin,则只需在对应网站的server{}中添加如下配置即可。

#------ nginx.conf phpmyadmin ------#
        location /phpmyadmin {
                alias /usr/share/phpMyAdmin;
                index index.php;
        }
        location ~ ^/phpmyadmin/.+\.php$ {
                if ($fastcgi_script_name ~ /phpadmin/(.+\.php)$) {
                        set $valid_fastcgi_script_name $1;
                }
                include        fastcgi_params;
                fastcgi_index  index.php;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_param  SCRIPT_FILENAME /usr/share/phpMyAdmin/$valid_fastcgi_script_name;
        }

#------ nginx.conf phpmyadmin end ------#

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *