Nginx with Yii and phpMyAdmin virtual host

Source: Internet
Author: User
Nginx configuration Yii and phpMyAdmin virtual host

The problem comes when we often need to use nginx when we deploy the project, we need to support URL rewriting, and we have to install a phpmyadmin. How do I get phpMyAdmin out of the Web root directory? Here is a sample configuration file:

?

server{Listen 80;     server_name dmis.sangou.net;     Index index.html index.htm index.php;     root/opt/www/dmis/;                         location/phpmyadmin {root/opt/www/;             Index index.php; } location ~ ^/phpmyadmin/.*\.                        (PHP|PHP5) $ {root/opt/www/;        Fastcgi_pass Unix:/tmp/php-cgi.sock;        Include Fastcgi_params;        Fastcgi_param document_root $document _root/phpmyadmin;        #fastcgi_pass 127.0.0.1:9000;        Fastcgi_index index.php;        Set $path _info $request _uri; if ($request _uri ~ ^ (. *) (\).        *) $ ") {set $path _info $;          } fastcgi_param path_info $path _info;        The location/{if (!-e $request _filename) {rewrite (. *)/index.php last;        }} location ~. *\.php?$ {Fastcgi_pass unix:/tmp/php-cgi.sock;        Include Fastcgi_params; #fastcgi_pass 127.0.0.1:9000;        Fastcgi_index index.php;        Set $path _info $request _uri; if ($request _uri ~ ^ (. *) (\).        *) $ ") {set $path _info $;    } fastcgi_param path_info $path _info; } #error_page 404 =/404.gif;}

?

?

You can see inside the phpMyAdmin virtual directory settings, the order is very fastidious. Then there is the URL rewrite rule that supports YII, which we use for location/qualification.

?

Next you log in to the PMA and you will find that you are redirected to the root directory, what's going on? After a search, found in the PMA has a setting $cfg [' pmaabsoluteuri '] = '; The default is automatic detection, here is the problem. But it's no use modifying this. We're going to hard put, directly modify the program file libraries/auth/cookie.auth.lib.php, find:

URL where to go:        $redirect _url = $cfg [' Pmaabsoluteuri ']. ' index.php ';

Revision changed to

URL where to go:        $redirect _url = '/phpmyadmin/index.php ';

It's done.?

?

?

?

1/F Uiexp 2011-08-23

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.