Issue
- I am running a NodeJS application in Nginx with a reverse proxy to port 3000
- PhpMyAdmin is configured and apparently runs in /phpmyadmin
- /etc/nginx/sites-available/default is configured like this:
server {
listen 80;
listen [::]:80;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name localhost mywebsite.com www.mywebsite.com;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /phpmyadmin {
root /var/www/html/phpmyadmin/;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
}
I managed to make all work as I wanted, but PhpMyAdmin has a bad display:
Before setting the reverse proxy in that file, PhpMyAdmin ran perfect. I assume there is something I missed in default
file.
Any ideas? Thanks
To Ivan Shatsky's Response: @IvanShatsky
I tried substituting with your code, but it downloads a file (it does not read .php files) - So, I added few more lines:
location ^~ /phpmyadmin {
index index.php;
try_files $uri $uri/ /phpmyadmin/index.php$is_args$args;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
The result is the same before.
When I check the resources of the network, this is what happens:
I have performed chmod 777 -R /var/www/html/phpmyadmin
but no changes. Would I need to have https? - I am currently trying on http.
Solution
I wonder how it is running at all. Assuming your phpMyAdmin located in the /var/www/html/phpmyadmin
directory, try this:
location /phpmyadmin {
index index.php;
try_files $uri $uri/ /phpmyadmin/index.php$is_args$args;
}
Answered By - Ivan Shatsky
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.