Configuring phpmyadmin to work with nginx help

I have created a symbolic link using ln -s /usr/share/phpmyadmin /home/tony/public_html/mywebsite.com/public to link phpmyadmin to my site.

However I get 404 error. I guess there's some problem with my nginx.conf. Can someone hlep? Thanks.

Here is my nginx.conf

server {

            listen   80;
            server_name mywebsiste.com;

            access_log /home/tony/public_html/mywebsiste.com/log/access.log;
            error_log /home/tony/public_html/mywebsiste.com/log/error.log;

location / {

            root /home/tony/public_html/mywebsiste.com/public/;
            index  index.html;
            }

#protect Munin folder
location = /munin {
  auth_basic            "Restricted";
  auth_basic_user_file  /etc/nginx/htpasswd;
}
location /phpmyadmin {
root /usr/share/phpmyadmin;
index index.php;
}

location ~ ^/phpmyadmin.+\.php$ {
fastcgi_pass 127.0.0.1:8888;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/tony/public_html/mywebsiste.com/$fastcgi_script_name;
#include /etc/nginx/fastcgi.conf;
include /etc/nginx/fastcgi_params;
} 
location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_FILENAME  /home/tony/public_html/mywebsiste.com/public$fastcgi_script_name;
}

}

1 Reply

I'm not using a symbolic link, that may be your problem, try moving phpmyadmin to where you want the link, that way you can eliminate that as a potential problem. If it still occurs, than its your config.

Here is the config I have for my phpmyadmin.

nginx.conf

user  www-data www-data;
worker_processes 2;
worker_cpu_affinity 0101 1010;
worker_rlimit_nofile 1024;
worker_priority -5;

events {
    worker_connections  2500;
    use epoll;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile      on;
    keepalive_timeout  60;
    tcp_nopush    on;
    tcp_nodelay   on;
    server_tokens off;

    server_names_hash_bucket_size 128;
    client_header_buffer_size 32k;
    large_client_header_buffers 4 32k;

    gzip on;
    gzip_comp_level 2;
    gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_vary on;
    gzip_http_version 1.0;
    gzip_min_length 1k;
    gzip_buffers 4 16k;

    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 /dev/null main;
    error_log /etc/server/log/nginx-error.log error;
    include /etc/server/nginx/sites-enabled/*;
}

fastcgi_params

fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  PATH_INFO          $fastcgi_script_name;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

fastcgi_param  REDIRECT_STATUS    200;

fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;

mysql.mydomain.com.conf

server {
    listen         192.168.1.1:80;
    server_name    mysql.mydomain.com;
    rewrite ^/(.*) https://mysql.mydomain.com/$1 permanent;
}

server {
    listen         192.168.1.1:443;
    ssl            on;
    ssl_certificate      /etc/ssl/localcerts/mysql.mydomain.com.crt;
    ssl_certificate_key  /etc/ssl/localcerts/mysql.mydomain.com.key;
    server_name    mysql.mydomain.com;
    root           /home/websites/mysql.mydomain.com/public_html;
    index          index.php index.html;

    location ~ /\. {
        deny       all;
    }

    location ~* \.(ico|css|js|gif|jp?g|png)(\?[0-9]+)?$ {
        expires 31d;
        break;
    }

    location ~ /libraries {
        deny       all;
    }

    if (-f $request_filename) {
        break;
    }

    location = /robots.txt  {
        log_not_found  off;
    }

    location = /favicon.ico {
        log_not_found  off;
    }

    location ~ .*\.php$ {
        fastcgi_param HTTPS on;
        fastcgi_pass   unix:/etc/server/php/php-fpm.socket;
        include        /etc/server/nginx/fastcgi_params;
    }
}

Hope it helps, I find I can spot problems with a bad config if I can see one that is working :)

PS - Some other info that may be useful to you :)

Everything compiled from source, except for the list at the bottom showing my aptitude packages :)

I am using Debian 5.0 32bit

PHP - 5.3.2

MySQL - 5.1.46

nginx - 0.7.65

xcache - 1.3.0

MagickWandForPHP - 1.0.8

suhosin - 0.9.31

suhosin-patch - 5.3.2-0.9.9.1

php-mail-header-patch - 5.3.2

fpm from the svn repository for the 5.3.x series

libevent - 1.4.13

ImageMagick - 6.6.1-5

subversion - 1.6.11

Installed apps from aptitude:

adduser                        install
apt                        install
apt-utils                    install
aptitude                    install
autoconf                    install
autoconf2.13                    install
automake                    install
automake1.4                    install
automake1.7                    install
automake1.9                    install
autotools-dev                    install
base-files                    install
base-passwd                    install
bash                        install
bind9-host                    install
binutils                    install
bsdmainutils                    install
bsdutils                    install
build-essential                    install
bzip2                        install
ca-certificates                    install
chkconfig                    install
comerr-dev                    install
coreutils                    install
cpio                        install
cpp                        install
cpp-4.3                        install
cron                        install
debconf                        install
debconf-english                    install
debian-archive-keyring                install
debianutils                    install
defoma                        install
diff                        install
dmidecode                    install
dnsutils                    install
dpkg                        install
dpkg-dev                    install
e2fslibs                    install
e2fsprogs                    install
file                        install
findutils                    install
fontconfig                    install
fontconfig-config                install
g++                        install
g++-4.3                        install
gcc                        install
gcc-4.2-base                    install
gcc-4.3                        install
gcc-4.3-base                    install
ghostscript                    install
ghostscript-x                    install
gnupg                        install
gpgv                        install
graphviz                    install
grep                        install
groff-base                    install
gs-common                    install
gs-gpl                        install
gsfonts                        install
gzip                        install
hostname                    install
ifupdown                    install
info                        install
initscripts                    install
insserv                        install
iproute                        install
iptables                    install
iputils-ping                    install
libacl1                        install
libatk1.0-0                    install
libattr1                    install
libbind9-40                    install
libblkid1                    install
libbz2-1.0                    install
libbz2-dev                    install
libc6                        install
libc6-dev                    install
libcairo2                    install
libcap2                        install
libcomerr2                    install
libconsole                    install
libcups2                    install
libcupsimage2                    install
libcurl3                    install
libcurl4-openssl-dev                install
libcwidget3                    install
libdatrie0                    install
libdb4.6                    install
libdevmapper1.02.1                install
libdirectfb-1.0-0                install
libdns45                    install
libedit2                    install
libept0                        install
libexif-dev                    install
libexif12                    install
libexpat1                    install
libexpat1-dev                    install
libfontconfig1                    install
libfreetype6                    install
libfreetype6-dev                install
libgcc1                        install
libgcrypt11                    install
libgd2-noxpm                    install
libgdbm3                    install
libglib2.0-0                    install
libgmp3-dev                    install
libgmp3c2                    install
libgmpxx4ldbl                    install
libgnutls26                    install
libgomp1                    install
libgpg-error0                    install
libgraphviz4                    install
libgs8                        install
libgtk2.0-0                    install
libgtk2.0-common                install
libice-dev                    install
libice6                        install
libidn11                    install
libidn11-dev                    install
libisc45                    install
libisccc40                    install
libisccfg40                    install
libjpeg62                    install
libjpeg62-dev                    install
libkadm55                    install
libkeyutils1                    install
libkrb5-dev                    install
libkrb53                    install
liblcms1                    install
liblcms1-dev                    install
libldap-2.4-2                    install
libldap2-dev                    install
liblocale-gettext-perl                install
libltdl3                    install
libltdl3-dev                    install
liblwres40                    install
libmagic1                    install
libmcrypt-dev                    install
libmcrypt4                    install
libmm-dev                    install
libmm14                        install
libmpfr1ldbl                    install
libncurses5                    install
libncurses5-dev                    install
libncursesw5                    install
libnewt0.52                    install
libpam-modules                    install
libpam-runtime                    install
libpam0g                    install
libpango1.0-0                    install
libpango1.0-common                install
libpaper1                    install
libpcre3                    install
libpcre3-dev                    install
libpcrecpp0                    install
libperl-dev                    install
libperl5.10                    install
libpixman-1-0                    install
libpng12-0                    install
libpng12-dev                    install
libpopt0                    install
libpthread-stubs0                install
libpthread-stubs0-dev                install
libreadline5                    install
libreadline5-dev                install
libsasl2-2                    install
libselinux1                    install
libsepol1                    install
libsigc++-2.0-0c2a                install
libslang2                    install
libsm-dev                    install
libsm6                        install
libss2                        install
libssh2-1                    install
libssh2-1-dev                    install
libssl-dev                    install
libssl0.9.8                    install
libstdc++6                    install
libstdc++6-4.3-dev                install
libsysfs2                    install
libt1-5                        install
libt1-dev                    install
libtasn1-3                    install
libtext-charwidth-perl                install
libtext-iconv-perl                install
libtext-wrapi18n-perl                install
libthai-data                    install
libthai0                    install
libtiff4                    install
libtimedate-perl                install
libts-0.0-0                    install
libusb-0.1-4                    install
libuuid1                    install
libwmf-dev                    install
libwmf0.2-7                    install
libwrap0                    install
libx11-6                    install
libx11-data                    install
libx11-dev                    install
libxapian15                    install
libxau-dev                    install
libxau6                        install
libxaw7                        install
libxaw7-dev                    install
libxcb-render-util0                install
libxcb-render0                    install
libxcb-xlib0                    install
libxcb-xlib0-dev                install
libxcb1                        install
libxcb1-dev                    install
libxcomposite1                    install
libxcursor1                    install
libxdamage1                    install
libxdmcp-dev                    install
libxdmcp6                    install
libxext-dev                    install
libxext6                    install
libxfixes3                    install
libxft2                        install
libxi6                        install
libxinerama1                    install
libxml2                        install
libxml2-dev                    install
libxmu-dev                    install
libxmu-headers                    install
libxmu6                        install
libxpm-dev                    install
libxpm4                        install
libxrandr2                    install
libxrender1                    install
libxslt1-dev                    install
libxslt1.1                    install
libxt-dev                    install
libxt6                        install
linux-libc-dev                    install
login                        install
logrotate                    install
lsb-base                    install
lzma                        install
m4                        install
make                        install
makedev                        install
man-db                        install
manpages                    install
mawk                        install
mktemp                        install
module-init-tools                install
mount                        install
nano                        install
ncurses-base                    install
ncurses-bin                    install
net-tools                    install
netbase                        install
netcat-traditional                install
openssh-blacklist                install
openssh-client                    install
openssh-server                    install
openssl                        install
passwd                        install
patch                        install
perl                        install
perl-base                    install
perl-modules                    install
pkg-config                    install
procps                        install
readline-common                    install
rsyslog                        install
sed                        install
sgml-base                    install
ssmtp                        install
sudo                        install
sysv-rc                        install
sysvinit                    install
sysvinit-utils                    install
tar                        install
tasksel                        install
tasksel-data                    install
tcpd                        install
traceroute                    install
ttf-dejavu                    install
ttf-dejavu-core                    install
ttf-dejavu-extra                install
tzdata                        install
ucf                        install
update-inetd                    install
util-linux                    install
wget                        install
whiptail                    install
x11-common                    install
x11proto-core-dev                install
x11proto-input-dev                install
x11proto-kb-dev                    install
x11proto-xext-dev                install
xml-core                    install
xtrans-dev                    install
zlib1g                        install
zlib1g-dev                    install

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct