0

I'm trying to set a custom URL for a reverse proxy. From what I understand, the code should be fairly straight forward. Here's what I've got:

worker_processes 1;

events {

     worker_connections 1024;

}

http {
    server {

        listen 8080;
        server_name www.example.com;

        location / {
            proxy_pass http://localhost:3000/;
        }
    }
}

Afterwards in terminal I made sure to type in the command:

sudo nginx -s reload

When I go to www.example.com I get "This site can’t be reached", but when I type "localhost:8080" into the url it successfully loads the content from localhost:3000.

What exactly am I doing wrong here?

  • does the custom url can be resolved? please show `nginx -Tt` – djdomi Jun 08 '22 at 16:34
  • running that command I get: nginx: the configuration file /Users/user/homebrew/etc/nginx/nginx.conf syntax is ok nginx: configuration file /Users/user/homebrew/etc/nginx/nginx.conf test is successful – jmsapps Jun 08 '22 at 17:09
  • but nginx -T exposure the full configuration which should be added to the question – djdomi Jun 08 '22 at 17:14
  • I deleted everything else so what you see in the question is the full configuration.. is this where I went wrong? lol I was following a tutorial for a simple reverse local proxy, found here https://kirillplatonov.com/posts/simple-reverse-proxy-on-mac-with-nginx/ – jmsapps Jun 08 '22 at 17:17
  • I already asked if the current custom url can be resolved? and will it be resolved correctly? – djdomi Jun 08 '22 at 17:27
  • Forgive me I only started learning Nginx yesterday. You are asking if I enter the command nginx -T if it is resolved correctly? I get the same response as I mentioned before: "Syntax is okay" and "test is successful" and then it just prints out everything I have in my configuration file, which is exactly what I have posted in the question above – jmsapps Jun 08 '22 at 17:45
  • Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/136903/discussion-between-jmsapps-and-djdomi). – jmsapps Jun 08 '22 at 18:18

0 Answers0