Nginx install and configure a reverse proxy

Today made a simple reverse proxy, has indeed failed, after then read the relevant documents, stroke clear ideas, recorded for future use.

A install nginx:

1. sudo apt-get update

2. sudo  apt-get install nginx

Second configure a reverse proxy:

1. We /etc/nginx/nginx.conf

2. 

{Server
  the listen 80; # port number
  server_name Ali cloud ip; # domain, because the domain name certification for three months waiting time, so use Ali cloud ip
  LOCATION / {
    proxy_pass http://127.0.0.1:8000/; # springboot start after item access path
    proxy_read_timeout 6000;
  }
  error_page 500 502 503 504 /50x.html;
  LOCATION = {/50x.html
    the root HTML;
  }
}

3. If an error, nginx -t view the configuration is correct

4. systemctl restart nginx restart nginx

Guess you like

Origin www.cnblogs.com/hooli/p/11886475.html