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