# Can't get nginx to work with Adminer nor phpMyadmin

**URL:** <https://www.ruby-forum.com/t/cant-get-nginx-to-work-with-adminer-nor-phpmyadmin/230157>\
**Category:** NGINX\
**Created:** [June 2, 2014, 8:17pm UTC](https://www.ruby-forum.com/t/cant-get-nginx-to-work-with-adminer-nor-phpmyadmin/230157 "2014-06-02T20:17:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jason\_sam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7993a0/32.png) [@jason\_sam](https://www.ruby-forum.com/u/jason_sam)\
**Post date:** [June 2, 2014, 8:17pm UTC](https://www.ruby-forum.com/t/cant-get-nginx-to-work-with-adminer-nor-phpmyadmin/230157/1 "2014-06-02T20:17:09Z")

</div>

I have been trying to set up Nginx with Adminer (and phpMyadmin), but I  
can’t seem to get it to work.

Here are my config files:

/etc/nginx/nginx.conf:  
[#user html;worker\_processes 1;#error\_log logs/error.log;#error\_log - Pastebin.com](http://pastebin.com/uNTAwuTp)\*  
\*  
/etc/nginx/sites-available/adminer:  
[server { listen 80; server\_name adminer; index adminer-3.3.3.php; - Pastebin.com](http://pastebin.com/cpwK1Bz2)

But still if I go to [http://server.ip/adminer](http://server.ip/adminer)

I only get “404 Not Found” error.

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 2, 2014, 8:44pm UTC](https://www.ruby-forum.com/t/cant-get-nginx-to-work-with-adminer-nor-phpmyadmin/230157/2 "2014-06-02T20:44:16Z")

</div>

The right link for you nginx.conf is:

> <https://pastebin.com/uNTAwuTp>

You could at least had that properly done…

Copy-pasting nginx configuration from somewhere else without  
understanding  
it has little chances of success.

What have you tried to configure?  
What do you expect from it (which directive does what)?

## Please copy the _relevant_ parts of your configuration in your messages here so further reference will be understandable.

_B. R._

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 2, 2014, 10:12pm UTC](https://www.ruby-forum.com/t/cant-get-nginx-to-work-with-adminer-nor-phpmyadmin/230157/3 "2014-06-02T22:12:42Z")

</div>

Sorry about the link. Don’t know how it happened.

So, the portions in question of nginx.conf are:

* * *

```
     server {
      server_name phpmyadmin.<domain.tld>;

      root /usr/share/webapps/phpMyAdmin;
      index index.php;

      location ~ \.php$ {
              try_files $uri =404;
              fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
              fastcgi_index index.php;
              include fastcgi.conf;
      }
     }

     server {
      server_name adminer.<domain.tld>;

      root /usr/share/webapps/adminer;
      index index.php;

      location ~ \.php$ {
              try_files $uri =404;
              fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
              fastcgi_index index.php;
              include fastcgi.conf;
      }
     }

```

* * *

And the /etc/nginx/sites-available/adminer file is:

* * *

```
 server {

  listen 80;
  server_name adminer;

  index adminer-3.3.3.php;
  set $root_path '/usr/share/webapps/adminer';
  root $root_path;

 try_files $uri $uri/ @rewrite;

  location @rewrite {
      rewrite ^/(.*)$ /index.php?_url=/$1;
  }

  location ~ \.php {
      fastcgi_pass unix:/run/php5-fpm.sock;
      fastcgi_index /adminer-3.3.3.php;

      include /etc/nginx/fastcgi_params;

      fastcgi_split_path_info ^(.+\.php)(/.+)$;
      fastcgi_param PATH_INFO $fastcgi_path_info;
      fastcgi_param PATH_TRANSLATED 

```

$document\_root$fastcgi\_path\_info;  
fastcgi\_param SCRIPT\_FILENAME  
$document\_root$fastcgi\_script\_name;  
}

```
  location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
      root $root_path;
  }

  location ~ /\.ht {
      deny all;
  }

 }

```

* * *

I don’t know if this file is necessary. The howtos for making  
Adminer/phpMyadmin work with Nginx are very limited to non-existent.

I want to be able to type [http://ipaddress/phpmyadmin](http://ipaddress/phpmyadmin) (or adminer) and  
see its respective interface. But as it is now, I only get 404 error.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 5, 2014, 10:46am UTC](https://www.ruby-forum.com/t/cant-get-nginx-to-work-with-adminer-nor-phpmyadmin/230157/4 "2014-06-05T10:46:04Z")

</div>

Hello

> > I want to be able to type [http://ipaddress/phpmyadmin](http://ipaddress/phpmyadmin) (or adminer)  
> > and see its respective interface. But as it is now, I only get 404  
> > error.
> 
> If you want [http://ipaddress/phpmyadmin](http://ipaddress/phpmyadmin) and [http://ipaddress/adminer](http://ipaddress/adminer) to  
> both work, you will probably want a single server{} block with all of  
> the configuration.

I must say I do not understand those config files.

Say, I only want to make adminer work, and we have a segment that goes  
like that

server {  
listen 80;  
server\_name [example.org](http://example.org) [www.example.org](http://www.example.org);  
…  
}

Where am I supposed to put the subfolder name here? Why are there those  
“[example.org](http://example.org)” domain names, if I am not even using a domain at the  
moment?

All I want is to  
[http://192.168.0.2](http://192.168.0.2) to point to the index file in root html folder  
and [http://192.168.0.2/adminer](http://192.168.0.2/adminer) to point to a html/adminer

And reading [How nginx processes a request](http://nginx.org/en/docs/http/request_processing.html) is  
confusing for that reason - I see no references to subfolders, just some  
domains.

I suppose that the “location” bit is taking care of subfolders, but if  
this is so, then… that would mean there is nothing to be set in  
“server” blocks.

I just don’t get it.

Cheers

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 3, 2014, 1:13am UTC](https://www.ruby-forum.com/t/cant-get-nginx-to-work-with-adminer-nor-phpmyadmin/230157/5 "2014-06-03T01:13:41Z")

</div>

On Mon, Jun 02, 2014 at 10:12:03PM +0200, KC wrote:

Hi there,

> I want to be able to type [http://ipaddress/phpmyadmin](http://ipaddress/phpmyadmin) (or adminer)  
> and see its respective interface. But as it is now, I only get 404  
> error.

If you want [http://ipaddress/phpmyadmin](http://ipaddress/phpmyadmin) and [http://ipaddress/adminer](http://ipaddress/adminer) to  
both work, you will probably want a single server{} block with all of  
the configuration.

[How nginx processes a request](http://nginx.org/en/docs/http/request_processing.html) for the reason.

After you’ve done that, configure each application independently,  
probably by wrapping the normal “it’s a php script” configuration within  
location blocks like

location ^~ /adminer/

After that, when you test, you can read the nginx logs to see exactly  
why the 404 was produced.

Good luck with it,

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
