I'm quite new to apache and even newer to reverse proxy, but I ended up installing a server with nginx (as a reverse proxy) and apache, to manage websites with different technologies. A php website (called php_site below) is handled by apache, a ruby on rails website is handled by nginx. More websites should be added later. Everything's working fine, except for phpmyadmin.
My problem : I can get to phpmyadmin login page (either through www.php_site.org/phpmyadmin/ or xx.xx.xx.xxx:8080/phpmyadmin/, xx being my server external IP), but I don't manage to log in. I'm pretty sure I have the good credentials, but when I submit the form, phpmyadmin login page simply reloads, without displaying errors.
My conf :
- ubuntu 16.04
- php 5.6 (because an old project needed it)
- phpmyadmin 4.5.4.1
- mysql 5.7.17
- Apache/2.4.18
phpmyadmin is installed in /usr/share/phpmyadmin/.
Nginx conf (php_site) :
# /opt/nginx/conf/conf.d/php_site.conf
server {
listen 80;
server_name www.php_site.org;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /phpmyadmin {
proxy_pass http://127.0.0.1:8080/phpmyadmin;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
client_max_body_size 15M;
}
server {
listen 80;
server_name php_site.org;
rewrite ^ http://www.php_site.org$request_uri? permanent;
}
Apache conf (php_site) :
# /etc/apache2/sites-available/php_site.conf
NameVirtualHost *:8080
<VirtualHost *:8080>
ServerName www.php_site.org
ServerAdmin myself@mail.com
DocumentRoot /var/www/php_site.com/htdocs
<Directory /var/www/php_site.com/htdocs >
AllowOverride All
DirectoryIndex index.php
</Directory>
ErrorLog /var/log/apache2/php_site-error.log
LogLevel warn
CustomLog /var/log/apache2/php_site.log combined
</VirtualHost>
<VirtualHost *:8080>
ServerName php_site.org
Redirect permanent / http://www.php_site.org/
</VirtualHost>
Questions :
- is there something wrong with my conf ?
- do I need to set
$cfg['PmaAbsoluteUri']in/etc/phpmyadmin/config.inc.php? And if yes, what is the correct value ? (cf https://docs.phpmyadmin.net/en/latest/faq.html#faq4-7) (I trid many with no success) - would it be better if I didn't proxy_pass php_my_admin ? (and manage instead to do something like http://www.jaredlog.com/?p=2117, even if my configuration is different ?)
Don't hesitate to ask fo further info if needed.