Link to home
Start Free TrialLog in
Avatar of doc_jay
doc_jay

asked on

nginx with multiple websites --need help with phpmyadmin please

CENTOS 7
NGINX
PHP-FPM

  I currently have one website named 'paperwork' successfully running in nginx, but need to add phpmyadmin as well.  Phpmyadmin was running in apache fine, but I switched to nginx.  I would like my 'paperwork' site to run on port '8888' and 'phpmyadmin' to run on port '80'.  Both of my services, 'nginx' and 'php-fpm' start fine without issues.

I have two '.conf' files in my '/etc/nginx/conf.d' folder and have that path included in my 'nginx.conf' file.

files I have in that folder:  'paperwork.conf' (this 'paperwork' site works just fine) & 'phpmyadmin.conf'

The current path to 'phpmyadmin' is '/usr/share/phpMyAdmin'

When I try to go to the 'phpmyadmin' site 'http://192.168.1.44/phpmyadmin' it comes back with a blank page.

in '/var/log/nginx/error.log', that file contains no errors
2015/02/17 08:39:17 [notice] 31891#0: signal process started

Open in new window


in 'var/log/phpMyAdmin.error.log' - this contains
2015/02/17 09:19:40 [error] 31893#0: *8 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 10.10.51.100, server: localhost, request: "GET /phpMyAdmin/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/php-fpm.sock:", host: "192.168.1.44"

Open in new window


Help please!

my '/etc/nginx/nginx.conf' file contents:

user  nginx;
worker_processes  2;

error_log  /var/log/nginx/error.log;

pid        /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;

    keepalive_timeout  65;

    include /etc/nginx/conf.d/*.conf;
	include /etc/nginx/sites-enabled/*;

    index   index.html index.htm;
}

Open in new window


my '/etc/php-fpm./www.conf' file contains:

user = nginx
group = nginx
listen = /var/run/php-fpm/php-fpm.sock
listen.owner = nginx
listen.group = nginx
listen.mode = 0660

Open in new window


Here is the contents of '/etc/nginx/conf.d/paperwork.conf':
server {
    listen       8888;
    server_name  localhost;
    set  $root_path '/var/www/html/paperwork/frontend/public';
    root  $root_path;

    index  index.php index.html index.htm;

    try_files $uri $uri/ @rewrite;

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

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        include 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;
    }
}

Open in new window


here is the content of 'phpmyadmin.conf'
server{
    listen 80;
    server_name localhost;
    access_log /var/log/phpMyAdmin.access_log;
    error_log /var/log/phpMyAdmin.error_log;

    location /phpMyAdmin {
      alias /usr/share/phpMyAdmin;
      index  index.html index.htm index.php;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param   SCRIPT_FILENAME /usr/share/phpMyAdmin$fastcgi_script_name;
    }

}

Open in new window

Avatar of R. Toby Richards
R. Toby Richards
Flag of United States of America image

For one thing, Nginx is case sensitive. You should be browsing to http://192.168.1.44/phpMyAdmin
Avatar of doc_jay
doc_jay

ASKER

I've tried that as well, same result.
ASKER CERTIFIED SOLUTION
Avatar of R. Toby Richards
R. Toby Richards
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of doc_jay

ASKER

I do believe your right!  thanks, all works as expected now.

One other thing, how can I call the 'phpmyadmin' site with 'http://my.ip.address/pma' instead?

I tried changing this:

location /phpMyAdmin {
      alias /usr/share/phpMyAdmin;
      index  index.html index.htm index.php;
    }

Open in new window


location /pma {
      alias /usr/share/phpMyAdmin;
      index  index.html index.htm index.php;
    }

Open in new window


..but as you probably already knew, it didn't work  ;-)