I am using Nginx as a reverse proxy for my Apache instillation and as a security feature it blocks access to phpmyadmin, webalizer etc for everyone except localhost but using nginx it makes Apache think it is localhost so it displays it publicly for everyone.

<LocationMatch "^/(?i:(?:xampp|security|phpmyadmin|licenses|webalizer|server-status|server-info))">
    Order deny,allow
    Deny from all
    Allow from ::1 127.0.0.0/8 \
        fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \
        fe80::/10 169.254.0.0/16

    ErrorDocument 403 /
</LocationMatch>

I need to turn the above rules pattern matching regex into the following.

location /phpmyadmin {
        proxy_pass         htt://127.0.0.1:8080/phpmyadmin;
        allow 127.0.0.1;
        deny all;
    }

Much appreciated for help from anyone who is familiar with regex in Nginx.

The following method works but breaks normal site urls that would be search engine friendly such as domain.com/forums/server-info

location ~ /(xampp|security|phpmyadmin|licenses|webalizer|server-status|server-info) {
    deny  all;
}
Edit
Report