Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

240
Views
nginx reverse proxy to localhost

I have application running on my AWS EC2 Instance's localhost:8080.

In order to use these Web portal, I have install nginx on EC2 and reversed proxy localhost so that I can access Web UI on my browser.

Nginx.conf file

server {
    listen 80;
    server_name ec2-xx-xx-xxx-xxx.eu-central-1.compute.amazonaws.com;

    location / {
    proxy_pass http://localhost:8080;

   location /$request_uri {
   proxy_pass http://localhost$request_uri;

} 

}

When hitting EC2 URL on my browser,I successfully seeing homepage of application.

But when I hit any url let's say /admin, Nginx redirects to my local computer's localhost:8080/admin not Server's localhost. All i want is that when hit any url nginx should forward the request to localhost:8080{$URL} and return me the browser.

please suggest where I'm wrong. Thanks In Advance.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You don't need to add the second location.

location / {
    proxy_pass http://localhost:8080;
    proxy_set_header   Host $http_host;
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   X-Forwarded-Proto $scheme;
}

this should be enough to access anything you need.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!