Access my web site without the port in the url?

July 20, 2015 10.1k views
Django Nginx

Hi,

Have a web site with gunicorn + nginx, but only achieve to access url.com.br:8000.

As I can configure to access only with url.com.br ?

tks.

2 Answers

You should use Nginx as a reverse proxy for your server, Here is a sample configuration for Nginx that may do what you want:

server {
   listen       80;
   server_name  url.com.br;

   access_log  /var/log/nginx/log/url.com.br.access.log  main;
   error_log  /var/log/nginx/log/url.com.br.error.log;
   root   /usr/share/nginx/html;
   index  index.html index.htm;

   location / {
      proxy_pass  http://127.0.0.1:8000;
      proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
      proxy_redirect off;
      proxy_buffering off;
      proxy_set_header  Host  $host;
      proxy_set_header  X-Real-IP   $remote_addr;
      proxy_set_header  X-Forwarded-For   $proxy_add_x_forwarded_for;
   }
}

Feel free to ask your questions about this settings.

  • Great, perfect!

    Tks.

  • Tkx. you mean to write these codes in ngix.conf.. right? i wanna refer my web page like if i typed 111.0.0.1:8080 ..... my tomcat for example… its work ..... but dont know yet how to refer these to my page www.blue-stone.net....

  • Hi,
    So I have navigated to the conf.d file in nginx, all i see in there are 2 directories “.” & “..”.
    How do i add my configuration settings for the reverse proxy as described above?
    Many many thanks in advance, this has been doing my head in for weeks!

    Chhers,
    P

Have another answer? Share your knowledge.