I configured nginx for port forwarding (port 80 to 8889)

and pointed out my domain to server IP address.

after this it successfully redirects me to server. when i try to access url through the Domain address

But after it redirects i am only able to see ip only instead of my url (i.e. mydomain.com) in address bar (i.e. xx.xx.xx.xx:8889) what i require to do if i want to display domain in addressbar?

this is my nginx config file.

server {
    listen 80;
    server_name mywebsite.com;
    proxy_connect_timeout 300;
    proxy_send_timeout 300;
    proxy_read_timeout 300;
    send_timeout 300;
    location / {
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://localhost:8888/;
    client_max_body_size 10M;
    error_page 404 /404.html;
    location = /40x.html { } error_page 500 502 503 504 /50x.html;
    location = /50x.html { }
  • edit your actual configuration into the question. – Gerald Schneider Oct 30 '17 at 9:22
  • Your nginx configuration looks good. Is it possible that the redirection comes from your application server, not nginx? – Gerald Schneider Oct 30 '17 at 9:27
  • added and i haven't done anything to rewrite url or any setting that display my domainName in browsers address bar... let me know how this can be done with nginx. – DexJ Oct 30 '17 at 9:27
  • hi @GeraldSchneider its just my doubt but do you think its fault of url pointing??? ! – DexJ Oct 30 '17 at 10:00
  • I think your application server is configured to force the wrong URL. – Gerald Schneider Oct 30 '17 at 10:02
  1. Check your app server configuration.
  2. on the box, check your hosts file and make sure you have the correct CNAME and ALIAS entries that include your web server.
  3. Clear the cache after making changes.

You should reboot after making any changes just to make sure the latest changes are picked up as services start.

  • thanks for your time Mika but this is not resolving my issue – DexJ Nov 2 '17 at 4:44

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.