Nginx can't find phpMyAdmin

nginx

Solution

It's really not a good idea to make a symbolic in your document root, that's just asking for trouble having a phmyadmin shortcut in www.

The right way to do it is to create a file called php and add to /etc/nginx/sites-available. You can copy the file below but change the port number to something else.

    server {
        listen 30425;

        # Don't want to log accesses.
        #access_log  /dev/null main;
        access_log  /var/log/nginx/php.acces_log main;
        error_log   /var/log/nginx/php.error_log info;

        root /usr/share/phpmyadmin;
        index  index.php index.html index.htm;
        error_page 401 403 404 /404.php;

        location ~ .*.php$ {
                include fastcgi_params;
                fastcgi_pass  127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param SERVER_NAME $http_host;
                fastcgi_ignore_client_abort on;

        }
}

Now you need to make symbolic link to sites enabled directory

ln -s /etc/nginx/sites-available/php//etc/nginx/sites-enabled

now you need to add this code to Logging Settings part of nginx.conf

log_format main ‘$remote_addr – $remote_user [$time_local] ‘
                ‘”$request” $status $body_bytes_sent “$http_referer” ‘
                ‘”$http_user_agent” “$http_x_forwarded_for”‘ ;

Now you can access your phpmyadmin with http://example.com:30425

Problem

Hello I have installed the newest stable Version of Nginex (1.4.4) and want to install also phpMyAdmin, unfortunately the following error appears when I try to open phpMyAdmin in my browser through http:// 192 . . . /phpmyadmin: ``` 404 Not Found nginx/1.4.4 ``` What exactly is the reason that Nginx can't find the phpMyAdmin file? This is the content of my /etc/nginx/nginx.conf file: ``` user nginx; worker_processes 4; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on; include /etc/nginx/conf.d/*.conf; } ``` Many Greetings

Original source