Is it possible to have a MySQL query in my Nginx config?

For example:

server {
        listen       80;
        $domain = [a way to get the current domain];
        $server_info = [a way to do the query (by $domain) and have some info returned];
        server_name $serverinfo;
        [do stuff]
  • 1
    Have a look at this NginX module (might be a bit outdated btw)
    – j0k
    Commented Jun 18, 2013 at 8:00

1 Answer 1


(Answer by @jOk)
You can use the NginX moudule located at https://github.com/arut/nginx-mysql-module which allows you to do exactly what you are asking to do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.