Ubuntu 14 - Nginx - PHP5-fpm: phpmyadmin installed, but 403 access denied

Nginx and PHP5-FPM are installed and working well ...

# I can access http://www.example.com and http://www.example.com/info.php

$ ls -la /var/www/html -rw-r--r-- 1 root root 868 Nov 1 08:16 index.html -rw-r--r-- 1 root root 21 Nov 1 08:13 info.php 

I installed phpmyadmin and created a symlink to phpmyadmin files

  lrwxrwxrwx 1 root root 21 Nov 1 08:37 phpmyadmin -> /usr/share/phpmyadmin 

but trying to get http://www.example.com/phpmyadmin => I get the forbidden 403

using a symlink, I don't need to add anything related to phpmyadmin in my nginx.conf ... what might be missing?

Update 1: adding index.php to uri leads to login panel

  http://www.example.com/phpmyadmin/index.php 

what should I add to my default file to get it directly ... I think my try file is not valid. here is my default nginx site con file

  server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /var/www/html; index index.php, index.html index.htm; server_name example.com; location / { try_files $uri $uri/ index.html index.php =404; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/www/html; } location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } } 
+5
source share
5 answers

it works fine after adding the following location:

  location /phpmyadmin { index index.php; } 
+8
source

What is my solution for this problem:

Step 1 : You must SSH and execute the command

 sudo nano /etc/nginx/sites-available/default 

Step 2 : find the block code

 server { .... } 

and then insert before the "}" server block

  location /phpmyadmin { index index.php; } 

It looks like

 server{ ...(your default)... location /phpmyadmin { index index.php; } } 

Hope this is yours!

+5
source

I added:

 location /pma/ { alias /usr/share/phpmyadmin/; index index.html index.htm index.php; location ~ ^/pma(.+\.php)$ { alias /usr/share/phpmyadmin$1; fastcgi_pass unix:/var/run/php5-fpm.sock; #OR fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin$1; include fastcgi_params; fastcgi_intercept_errors on; } } 

Thus, when the user accesses the /pma/ directory, he goes to /usr/share/phpmyadmin , which is also a bit more secure. As before, I also had a 403 error!

But the main fix for error 403 actually implements the line:

 index index.html index.htm index.php; 
+3
source

Lose the comma and you're fine

  index index.php, index.html index.htm; 
+1
source

Here are a few things you could try. One of them is disable_symlinks :

 location /phpmyadmin { disable_symlinks off; } 

Another option is to use an alias instead of a symbolic link:

 location /phpmyadmin { alias /usr/share/phpmyadmin; } 
0
source

Source: https://habr.com/ru/post/1206002/


All Articles