how to fix "Invalid command 'set_real_ip_from'" error?

Looks like this module is enabled (--with-http_realip_module), but you just copied the example configuration from the module page.

The set_real_ip directive should be set in the backend server, not in the proxy one. Then you only need to use one line, what should be:

set_real_ip_from  192.168.2.1;

but replace 192.168.2.1 by the local address your backend server is listening to.

EDIT: so, to answer to some more information you've added in the comments so far, httpd.conf is a configuration file for apache (httpd) and nginx directives won't work in them. You should read apache documentation in order to configure it the way you need. (The rpaf module seems to be the one you're looking for. This may be useful for you)