Nginx is equipped with Yii and phpMyAdmin virtual hosts

Source: Internet
Author: User
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

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.