I have installed nginx,php7.0-fpm and mysql on my ubuntu 16.04 server. Everything works fine however It doesn't load a setup page of phpmyadmin. Below is my phpmyadmin nginx block.
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
include fastcgi_params;
}
}
Below are my nginx access logs
/usr/share# tail -f /var/log/nginx/access.log
127.0.0.1 - - [15/Oct/2016:17:13:06 +0530] "GET /phpmyadmin/setup/index.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
127.0.0.1 - - [15/Oct/2016:17:13:06 +0530] "GET /phpmyadmin/setup/index.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
127.0.0.1 - - [15/Oct/2016:17:13:41 +0530] "GET /phpmyadmin/setup/index.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
127.0.0.1 - - [15/Oct/2016:17:13:44 +0530] "GET /phpmyadmin/setup/index.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
127.0.0.1 - - [15/Oct/2016:17:13:46 +0530] "GET /phpmyadmin/setup/index.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
127.0.0.1 - - [15/Oct/2016:17:13:46 +0530] "GET /phpmyadmin/setup/index.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
127.0.0.1 - - [15/Oct/2016:17:13:47 +0530] "GET /phpmyadmin/setup/index.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
127.0.0.1 - - [15/Oct/2016:17:13:47 +0530] "GET /phpmyadmin/setup/index.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
127.0.0.1 - - [15/Oct/2016:17:21:26 +0530] "GET /phpmyadmin/setup/index.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
127.0.0.1 - - [15/Oct/2016:17:21:28 +0530] "GET /phpmyadmin/setup/index.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
I do not have anything in nginx error log. php7.0-fpm is also running normally below is the log extract of the same.
tail -f /var/log/php7.0-fpm.log
[15-Oct-2016 17:09:48] NOTICE: fpm is running, pid 17062
[15-Oct-2016 17:09:48] NOTICE: ready to handle connections
[15-Oct-2016 17:09:48] NOTICE: systemd monitor interval set to 10000ms
[15-Oct-2016 17:21:10] NOTICE: Terminating ...
[15-Oct-2016 17:21:10] NOTICE: exiting, bye-bye!
[15-Oct-2016 17:21:11] NOTICE: configuration file /etc/php/7.0/fpm/php-fpm.conf test is successful
[15-Oct-2016 17:21:11] NOTICE: fpm is running, pid 17297
[15-Oct-2016 17:21:11] NOTICE: ready to handle connections
[15-Oct-2016 17:21:11] NOTICE: systemd monitor interval set to 10000ms
I need expert advice on this as I tried to change php-fpm listen mode from localhost port 9000 to php.sock. Same can observed in phpmyadmin nginx block config.
With the exception of the phpmyadmin addition, typically your
/etc/nginx/sites-available/default
file should look like so in order for it to process PHP:So when you open a
.php
file in your browser, this location directive will process.php
files including the filefastcgi-php.conf
and it will pass the php script to php7.0-fpm.Immediately after making any changes to any Nginx configuration file, test the configuration file like so
sudo nginx -t
, if all is well you should see this output:Then type
sudo service nginx reload
You can test it out by adding a
ghi.php
file that will contain this snippet:You want to go to
cd /var/www/html
and from inside of there you can dosudo vim ghi.php
Then you go to your
<server-ip-address>/ghi.php
and if you don't see anything then your server is still not processing php.