?
Solved

nginx with multiple websites --need help with phpmyadmin please

Posted on 2015-02-17
5
Medium Priority
?
98 Views
Last Modified: 2016-05-27
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

0
Comment
Question by:doc_jay
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:R. Toby Richards
ID: 40614778
For one thing, Nginx is case sensitive. You should be browsing to http://192.168.1.44/phpMyAdmin
0
 

Author Comment

by:doc_jay
ID: 40614782
I've tried that as well, same result.
0
 
LVL 5

Accepted Solution

by:
R. Toby Richards earned 2000 total points
ID: 40614791
I believe your server section requires a root path directive.
0
 

Author Comment

by:doc_jay
ID: 40614842
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  ;-)
0

Featured Post

RHCE - Red Hat OpenStack Prep Course

This course will provide in-depth training so that students who currently hold the EX200 & EX210 certifications can sit for the EX310 exam. Students will learn how to deploy & manage a full Red Hat environment with Ceph block storage, & integrate Ceph into other OpenStack service

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question