Desired result:
Visithttp://url.com
Automatically jump the URL to http://url.com:9000
, similar to the 301 jump, the address bar also Follow the changes.
Since the URL url.com
does not exist, the host is written locally to point to the IP
Write the following content in nginx:
server {
listen 80;
server_name url.com;
location / {
proxy_pass http://url.com:9000;
}
}
But when testing the nginx configuration file, it prompts:
$ sudo nginx -t
nginx: [emerg] host not found in upstream "seafile.sfdev.com" in /etc/nginx/sites-enabled/seafile.conf:5
nginx: configuration file /etc/nginx/nginx.conf test failed
Or choose directly:
If it is a direct jump, there is no need to add the location field, directly:
The proxy_pass in your configuration file forwards the request to the proxy server. For details, please see here:
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass
Try it
rewrite ^ url redirect
You don’t need a proxy, just rewrite the url rewrite ^/(.*)$ http://url.com:9000/$1 permanent;