Nginx configures the Yii and phpMyAdmin virtual hosts. we often need to use Nginx when deploying projects. at the same time, we need to support url rewriting and install phpmyadmin. this is the case. How can I make phpmyadmin not under the web root directory? The following is an example of a configuration file :? Configure the Yii and phpMyAdmin virtual hosts for server Nginx
We often need to use Nginx when deploying a project. we also need to support url rewriting and install phpmyadmin. this is the case. How can I make phpmyadmin not under the web root directory? The following is an example of a 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 $1; } fastcgi_param PATH_INFO $path_info; } 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 $1; } fastcgi_param PATH_INFO $path_info; } #error_page 404 = /404.gif;}
?
?
We can see that the Phpmyadmin virtual directory settings are very exquisite in the order. Then, the url rewriting rules of yii are supported. We use location/to limit it.
?
After you log on to pma, you will find that you are redirected to the root directory. what is the problem? After some searching, we found that $ cfg ['pmaabsoluteuri '] = ''was set in pma. by default, it was automatically detected, and there was a problem here. However, modification is useless. You can modify the libraries/auth/cookie. auth. lib. php file and find:
// URL where to go: $redirect_url = $cfg['PmaAbsoluteUri'] . 'index.php';
? Change
// URL where to go: $redirect_url = '/phpmyadmin/index.php';
? Done .?
?
?
?
Uiexp