nginx配置jar包设置绑定域名访问

后台启用jar包,然后绑定对应端口域名:

nohup java -jar abc.jar --spring.profiles.active=test >abc.txt &

.conf文件如下:

server {
        listen 80;
        server_name t.abc.com;

        index index.php index.html index.htm;
        location /{
            proxy_pass http://127.0.0.1:8012/;
                        
            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-For $remote_addr;
        }

 }

  

proxy_pass 地址端口需要跟配置文件中的 server:port相同。

原文地址:https://www.cnblogs.com/todarcy/p/13439279.html