Can't get nginx to work with Adminer nor phpMyadmin

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:
http://pastebin.com/uNTAwuTp*
*
/etc/nginx/sites-available/adminer:
http://pastebin.com/cpwK1Bz2

But still if I go to http://server.ip/adminer

I only get “404 Not Found” error.

What am I doing wrong?

The right link for you nginx.conf is:
http://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.

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 (or adminer) and
see its respective interface. But as it is now, I only get 404 error.

Hello

I want to be able to type 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 and 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 www.example.org;

}

Where am I supposed to put the subfolder name here? Why are there those
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 to point to the index file in root html folder
and http://192.168.0.2/adminer to point to a html/adminer

And reading 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

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

Hi there,

I want to be able to type 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 and http://ipaddress/adminer to
both work, you will probably want a single server{} block with all of
the configuration.

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. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs