Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running ngnix and php5-fpm and I'm on Ubuntu 13.04

server {
access_log /srv/www/;
error_log /srv/www/;
root /srv/www/;

location / {
    index index.html index.htm index.php;

location ~ \.php$ {
    include /etc/nginx/fastcgi_params;
    fastcgi_pass  unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME /srv/www/$fastcgi_script_name;

I have a symbolic link to /usr/share/phpmyadmin in /srv/wwww/

Not sure what's going on and I'm pretty new to all this.

share|improve this question
Check your error log, of course. – Michael Hampton Aug 31 '13 at 20:37
There's nothing in my nginx error log or the php5-fpm error log, i'm not sure where else to look – illspirit Sep 1 '13 at 2:51

Without knowing much about the specific error, I'm going to say you should check file permissions (that's usually what "forbidden" errors are about in my experience).

Go to your html root directory (/srv/www/, it looks like) and type

ls -Z

or possibly

ls -l

then make sure all the files belong to the user the web server is running under. They should have a user and group that looks appropriate to your web server - I haven't used that one specifically. Or they might be root, I've seen that before. The SELinux context (you'll only see that with the first command) should be something like


It might not be exactly that but if it's got "http" in there or otherwise looks web-related you're probably okay. Don't be alarmed if it doesn't show up; I'm not sure that Ubuntu would even force that. You might only get the user/group permissions.

Including the SELinux context, you should get results something like this:

drwxr-xr-x. apache apache unconfined_u:object_r:httpd_sys_rw_content_t:s0 css
drwxr-xr-x. apache apache unconfined_u:object_r:httpd_sys_rw_content_t:s0 downloads

though again, maybe not exactly. With the second command it would look more like this:

drwxr-xr-x.  2 apache apache 4096 Aug 19 00:41 css
drwxr-xr-x.  3 apache apache 4096 Jun 26 22:36 downloads

Once again, the user and group might not necessarily be apache. If it's something related to your web server, or possibly root, that's good to.

If the user and group are wrong, you can change them with:

chown -R user:group folder

If the SELinux context is wrong (if it's not even there you probably don't need to worry about it) you can fix it with:

chcon -R -t httpd_sys_content_t /srv/wwww/

It might also be an issue with a missing module or something for your web server. I've never used ngnix before, but I remember when using lighttpd instead of my usual apache I had this very same unexpected difficulty with php files. I had to install a module and make a minor configuration change. Unfortunately I can't offer any advice beyond that - like I said, I haven't used ngnix specifically.

share|improve this answer
Thank you, unfortunately I triple checked my permissions for my /srv/wwww/ and /usr/share/phpmyadmin. nginx is running from www-data and www-data is configured in the php5-fpm config file. I'm not sure where else I need to check – illspirit Sep 1 '13 at 2:53
I would expect only in the web root itself and possibly phpmyadmin, as you have. If it is a script issue, you can probably verify it by trying to access a simple HTML file from within your web root. If you can use that but not the PHP files associated with phpmyadmin, you're probably missing a module or have something misconfigured. EDIT: Actually there is one last permission thing, make sure that directories above are also readable and possibly executable to the server. Having the right permissions in the directories themselves might not help if it can't see them in the first place. – Dylan Sep 1 '13 at 5:22
Yeah I'm not sure what was going on, I got it to work another way though thank you for your help! – illspirit Sep 1 '13 at 5:51
What was the other way you got it to work? – Drew Khoury Sep 1 '13 at 13:56
I posted it below – illspirit Sep 2 '13 at 19:23

Well I'm not sure what I was doing wrong with the symbolic link, but I decided to take this route instead and it works! I just decided to give phpmyadmin it's own subdomain.

On Ubuntu 13.04 you have to make sure to use

fastcgi_pass unix:/var/run/php5-fpm.sock;

instead of


That was giving me some issues too.

server {
   listen   80;
   access_log /var/log/nginx/phpmyadmin/access.log;
   error_log /var/log/nginx/phpmyadmin/error.log;
   root /usr/share/phpmyadmin;

   location / {
       index  index.php;

   ## Images and static content is treated different
   location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
       access_log        off;
       expires           360d;

   location ~ /\.ht {
       deny  all;

   location ~ /(libraries|setup/frames|setup/libs) {
       deny all;
       return 404;

   location ~ \.php$ {
       include /etc/nginx/fastcgi_params;
       fastcgi_pass unix:/var/run/php5-fpm.sock;
       fastcgi_index index.php;
       fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin$fastcgi_script_name;


share|improve this answer

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.