You are not logged in.

#1 2013-05-21 01:04:36

AJCR
Member
Registered: 2012-12-14
Posts: 14

[RESOLVED] Can't get nginx and phpmyadmin to work

I am new to nginx. I have always used apache. So maybe I don't know enough about nginx to make this work. I am no newbie to arch though.

I have tried EVERYTHING. Also I have thoroughly searched the forum and google and no, none of the solutions worked. I have a VPS with DigitalOcean (great provider, btw) and I have mariadb, nginx, and php-fpm running perfectly. Everything works. However, I can't get phpmyadmin to work. I have followed the wiki (https://wiki.archlinux.org/index.php/Ph … figuration) and it still doesn't work. I keep getting a 403 error. I would provide you with a domain name but I haven't tied one to the VPS yet. Here is the IP address: http://198.199.86.65/phpmyadmin/

My root directory is /usr/share/nginx/html and if I run an ls /usr/share/nginx/html command I get the following back:
index.html  phpmyadmin

the directory is obviously there.

My nginx.conf file reads as such:

#user html;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       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  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        location ~ \.php$ {
		fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;
      	fastcgi_index  index.php;
      	root   /usr/share/nginx/html;
      	include        fastcgi.conf;
        }

		
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }

	server {
listen 80;
server_name localhost;

root /usr/share/nginx/html/phpmyadmin;
index index.php;
fastcgi_index index.php;

location ~ \.php$ {
include /etc/nginx/fastcgi.conf;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/phpmyadmin$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}


}
	
    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

Any help would be greatly appreciated.

Last edited by AJCR (2013-05-22 15:03:50)

Offline

#2 2013-05-21 01:45:42

andy123
Member
Registered: 2011-11-04
Posts: 169
Website

Re: [RESOLVED] Can't get nginx and phpmyadmin to work

The problem appears to be, that the server doesn't redirect to the index.php in the phpmyadmin folder. Opening the url http://198.199.86.65/phpmyadmin/index.php works for me. To fix this, you need to change this

        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;
        }

into this

        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm index.php;
        }

i'm sorry for my poor english wirting skills…

Offline

#3 2013-05-21 01:55:29

AJCR
Member
Registered: 2012-12-14
Posts: 14

Re: [RESOLVED] Can't get nginx and phpmyadmin to work

YOU. ARE. THE. MAN.

Thank you so much. Problem resolved.

Offline

#4 2013-05-21 13:22:53

andy123
Member
Registered: 2011-11-04
Posts: 169
Website

Re: [RESOLVED] Can't get nginx and phpmyadmin to work

Glad I could help big_smile
How about adding a [solved] in front of the topic, in case someone searches for this in the future?


i'm sorry for my poor english wirting skills…

Offline

Board footer

Powered by FluxBB