Nginx-phpmyadmin log in to the front page of the problem

Source: Internet
Author: User
For a long time, it is useless.

server {    listen 80;    server_name localhost;    root /home/wwwroot;    index index.html index.htm index.php;    location /pma {         root /home/wwwroot;         index index.php;    }    location ~ ^/pma/.*\.(php|php5)$ {                          root /home/wwwroot;        fastcgi_pass unix:/var/run/php5-fpm.sock;                fastcgi_index index.php;              include fastcgi_params;      }       if (!-e $request_filename) {        rewrite  ^/(.*)$  /index.php/$1  last;        break;    }       location ~ \.php$ {           fastcgi_pass unix:/var/run/php5-fpm.sock;        fastcgi_index index.php;        fastcgi_split_path_info ^(.+\.php)(.*)$;        include fastcgi_params;    }}

There's a fastcgi_params.
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Fastcgi_param script_name $fastcgi _script_name;

Reply content:

For a long time, it is useless.

server {    listen 80;    server_name localhost;    root /home/wwwroot;    index index.html index.htm index.php;    location /pma {         root /home/wwwroot;         index index.php;    }    location ~ ^/pma/.*\.(php|php5)$ {                          root /home/wwwroot;        fastcgi_pass unix:/var/run/php5-fpm.sock;                fastcgi_index index.php;              include fastcgi_params;      }       if (!-e $request_filename) {        rewrite  ^/(.*)$  /index.php/$1  last;        break;    }       location ~ \.php$ {           fastcgi_pass unix:/var/run/php5-fpm.sock;        fastcgi_index index.php;        fastcgi_split_path_info ^(.+\.php)(.*)$;        include fastcgi_params;    }}

There's a fastcgi_params.
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Fastcgi_param script_name $fastcgi _script_name;

My approach is to configure PHP, and then go directly to the document_root to create a soft link to the PMA.

[16:56] caiknife@caiknife-ThinkPad-T400:/usr/share/nginx/html> ll总用量 12K-rw-r--r-- 1 root     root     537  5月 13  2013 50x.htmllrwxrwxrwx 1 caiknife caiknife  43  9月 30 09:49 cakestrap -> /home/caiknife/source/cakestrap/app/webroot-rw-r--r-- 1 root     root     612  5月 13  2013 index.html-rwxrwxrwx 1 caiknife caiknife  17  9月 21 10:52 phpinfo.phplrwxrwxrwx 1 caiknife caiknife  21  9月 22 10:18 phpmyadmin -> /usr/share/phpmyadminlrwxrwxrwx 1 caiknife caiknife  21 10月 12 18:27 pma -> /usr/share/phpmyadmin

Then direct access to the subdirectory is possible.

Update

According to the main idea, I made the following configuration:

location /p {    root /usr/share/phpmyadmin;    index index.php;}location ~ ^/p/.*\.(php|php5)$ {                      root /usr/share/phpmyadmin;    fastcgi_split_path_info ^(.+\.php)(/.+)$;    fastcgi_pass unix:/var/run/php5-fpm.sock;    fastcgi_index index.php;    

After restarting Nginx, visit http://localhost:81/p and get the 404 page. My nginx port is listening for 81, and 80 port is reserved for Apache.

Why did you get an error 404? Look at the error log:

2013/12/13 23:17:55 [error] 5276#0: *1 open() "/usr/share/phpmyadmin/p" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /p HTTP/1.1", host: "localhost:81"

As you'll see from log, after you rewrite root, when you access the phpMyAdmin subdirectory, the physical path you actually access is Document_root + ' phpMyAdmin '.

OK, then I'll create a soft link.

$ sudo ln -s /usr/share/phpmyadmin/ /usr/share/phpmyadmin/p

Now the access is OK.

A lot of trouble, originally a soft link can be done, now to two configuration + a soft link can be done, several times at once.

  • 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.