1

I am new to nginx and am for some reason failing at setting up forwarding on nginx. I've looked through several guides and my setup looks to be fine from what i've read. What I am trying to do is forward a request like www.example.com to a different url such as http://example2.com/get/to/information. I'm not doing any port forwarding so everything will be using port 80.

Here is my current config:

server {
        listen 80;
        server_name www.example.com;

        location / {
                proxy_pass http://example2.com/access/this/information
        }
}

Additional information - It is not forwarding the information to another nginx server. I just want it to forward to a URL on another server on port 80. What i've tried to do so far is go to www.example.com (which is an A record that points to the IP address of the nginx server) but it continues to just send me to the nginx homepage

Any help would be appreciated!

0

Simple fail from ya :D

After the www.example.com must be an Semikolon (is this the english Word for this Symbol right here: ; )

Example:

Put this in there

server_name www.example.com;

And of course set the Semikolon after the proxy_pass line also

| improve this answer | |
  • Darn I can't believe I didn't notice the semi colon. I did an nginx -t to check for syntax on the file and it didn't return with any errors but everything looks good now. Thank you very much for that even though it was an extremely simple question! :) – Nare Sep 9 '16 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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