Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to set up an alias so when someone accesses /phpmyadmin/, nginx will pull it from /home/phpmyadmin/ rather than from the usual document root. However, everytime I pull up the URL, it gives me a 404 on all items not pulled through fastcgi. fastcgi seems to be working fine, whereas the rest is not. strace is telling me it's trying to pull everything else from the usual document root, yet I can't figure out why. Can anyone provide some insight?

Here is the relevant part of my config:

            location ~ ^/phpmyadmin/(.+\.php)$
                    include fcgi.conf;
                    fastcgi_index index.php;
                    fastcgi_pass  unix:/tmp/php-cgi.sock;
                    fastcgi_param SCRIPT_FILENAME /home$fastcgi_script_name;

            location /phpmyadmin
                    alias /home/phpmyadmin/;
share|improve this question
Why are people downvoting this? Just because you can't figure it out doesn't mean it's a bad question. At least provide a reason for the downvotes, kiddies. –  Rob Apr 2 '12 at 6:50
As a long-time apache user new to nginx, I find this really strange and unnecessarily complicated. I spent several hours looking through documentation to try to understand why. Can someone please explain this behaviour? Aliases should be just that - an alias to a location. –  tudor Oct 28 at 4:08

2 Answers 2

up vote 3 down vote accepted

Figured out a way. I'm not sure if it's the BEST, but it's certainly working right now.

Here's what I did:

        location ~ ^/phpmyadmin/(.*)$
                alias /home/phpmyadmin/$1;
share|improve this answer

I'm not sure but have you tried writing it this way:

location /phpmyadmin/
                alias /home/phpmyadmin/;

Also, what's the URI from which you are trying to access it?

As far as I understand it, you have to use the URI


and not just


You can read more about it here: http://wiki.nginx.org/HttpCoreModule

share|improve this answer
Thank you for an answer, at least. But yeah. I've tried that. Same thing. –  Rob Apr 2 '12 at 20:31
Maybe you have to add the alias to the other location. You could compare your config to the ones there: serverfault.com/questions/223028/… –  Black-Pixel Apr 2 '12 at 20:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.