Can't get nginx to reroute from test page, on

2019-08-07 18:35发布

I believe I set everything up correctly. I installed nginx on linux AMI, and the landing page that says "welcome to nginx on linux ami" is displaying correctly.

1) I created /etc/nginx/sites-available as well as /etc/nginx/sites-enabled.

2) I added a file I named test.conf which contained:

server {
  listen 80;
  server_name test;
  location / {
    proxy_set_header  X-Real-IP  $remote_addr;
    proxy_set_header  Host       $http_host;
    proxy_pass        http://127.0.0.1:3000;
  }
}

3) I added a symlink with the following command:

sudo ln -s /etc/nginx/sites-available/test.conf /etc/nginx/sites-enabled/test.conf

4) inside the HTTP block of /etc/nginx/nginx.conf, I added:

include /etc/nginx/sites-enabled/*;

5) restarted nginx

if I go to myURL:3000 I can see what I want to see, but myURL:80 does not reroute to 3000, and stays on the nginx landing page :(. the symlink looks good. Maybe it's a problem of where I put the line in step 4?

0条回答
登录 后发表回答