0

Im still learning server things so hope the title is descriptive enough.

Basically i have sub.domain.com that i want to run on nginx at port 8090.

I want to leave apache alone and have it catch all default traffic at port 80.

so i am trying something with a virtual name host to proxy pass to sub.domain.com:8090, nothing working yet and go no idea what the right syntax could be.

any ideas? most of what i found was to pass TO apache FROM nginx, but i want to the do the opposite.

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_http_module modules/mod_proxy_http.so

<VirtualHost sub.domain.com:80>

ProxyPreserveHost On

ProxyRequests Off

ServerName sub.domain.com

DocumentRoot /home/app/public

ServerAlias sub.domain.com

proxyPass / http://appname:8090/ (also tried localhost and sub.domain.com)

ProxyPassReverse / http://appname:8090/

</VirtualHost>

when i do this i get

[warn] module proxy_module is already loaded, skippin

[warn] module proxy_http_module is already loaded, skipping

[error] (EAI 2)Name or service not known: Could not resolve host name sub.domain.com -- ignoring!

and yes, the app is working (i have it running on port 80 with another subdomain) and it works at sub.domain.com:8090

2 Answers 2

1

[error] (EAI 2)Name or service not known: Could not resolve host name sub.domain.com -- ignoring!

This is saying that it cannot resolve sub.domain.com to an IP address. You need to arrange for your server to be able to do this. How you do that depends on how the DNS resolver is configured on it.

2
  • thanks. i want to run port 80 apache and port 8090 nginx on the same IP though..
    – petergus
    Dec 5, 2012 at 12:51
  • i have updated my apache2.conf virtualHost to only the servername and ProxyPass / http://sub.domain.com:8090/ ProxyPassReverse / http://sub.domain.com:8090/ and no errors, and as geekride suggested above running "host sub.domain.com" validated to my ip...
    – petergus
    Dec 5, 2012 at 13:03
0

The first two lines in your logs

[warn] module proxy_module is already loaded, skippin

[warn] module proxy_http_module is already loaded, skipping

says that those 2 modules are already loaded. So, you can remove the LoadModule lines, which you had written in the post.

For the third error line

[error] (EAI 2)Name or service not known: Could not resolve host name sub.domain.com -- ignoring!

there could be different reasons for the same, might be your dns server not configured properly, but for a quick fix what you can do is to put an entry in the /etc/hosts file with contents like this

ip_address sub.domain.com

The ip_address, should be replaced by the IP on which nginx is running. It could be 127.0.0.1 or some other IP.

Though this is not the best fix, but it should fix your problem.

If this still doesn't help, would be great if you can post the output of the following command here, after running this on the server where you are running apache.

host sub.domain.com

5
  • thanks! yes ive removed the module lines, that seemed logical. The thing is i want to run sub.domain.com on the same ip as apache just on another port (so i chose 8090). so since apache is the default and all traffic at anything.domain.com goes to port 80 apache, then i guess i need to tell apache to somehow send sub.domain.com to sub.domain.com:8090... ya, i havnt wrapped my head around how that should work. :: host sub.domain.com return my vaild IP (and piv6)
    – petergus
    Dec 5, 2012 at 12:49
  • i changed my proxy pass and passreverse to my sub.domain.com:8090 and commented out everything else except server name. no more error but not working either.
    – petergus
    Dec 5, 2012 at 13:05
  • That's weird. Can you please tell me the output of this command: # netstat -npl | grep 8090
    – Napster_X
    Dec 5, 2012 at 18:14
  • tcp 0 0 0.0.0.0:8090 0.0.0.0:* LISTEN 833/nginx
    – petergus
    Dec 7, 2012 at 8:57
  • in anycase i think ill just leave so we have to type in ....com:8090 to get there, but ya, still curious how this should work!! :)
    – petergus
    Dec 7, 2012 at 8:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .