'How to configure nginx to serve single named virtualhost when apache2 has multiple virtualhost

i have two virtual hosts

Name: host1.localhost.com & host2.localhost.com

I want to reverse proxy through nginx for host1.localhost.com

apache2 ports configuration : Listen 8090 apache2 configuration for host1 :

<VirtusalHost *:8090>
  ServerName host1.localhost.com
  DocumentRoot /var/www/facebook
  DirectoryIndex index.html
</VirtualHost>

apache2 configuration for host2 :

<VirtualHost *:8090>
  ServerName host2.localhost.com
  DocumentRoot /var/www/facebook
  DirectoryIndex index.html
</VirtualHost>

nginx server configuration:

server {
 listen 80;
 location / {
 proxy_pass http://127.0.0.1:8090;
}
}

Now i need to access host1.localhost.com through apache2 server like host1.localhost.com:8090.

And host2.localhost.com need to reverse proxy through nginx.

And nginx server do not have to authortiy to run host1.localhost.com.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source