Dotnet ASP Web API LXC Proxmox VE Helper Script Issue With Nginx #537

Closed
opened 2026-02-04 19:39:59 +03:00 by OVERLORD · 10 comments
Owner

Originally created by @JeepNWilly on GitHub (Feb 22, 2025).

Have you read and understood the above guidelines?

Yes

📜 What is the name of the script you are using?

Dotnet ASP Web API LXC

📂 What was the exact command used to execute the script?

bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/dotnetaspwebapi.sh)"

📝 Provide a clear and concise description of the issue.

I have installed the LXC a few times and I keep getting.
502 Bad Gateway
nginx/1.24.0 (Ubuntu).

What I see in the error.log is as follows.
2025/02/20 12:44:36 [error] 256#256: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.20.5, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "192.168.20.154"

⚙️ What settings are you using?

  • Default Settings
  • Advanced Settings

🖥️ Which Linux distribution are you using?

Ubuntu 24.04

🔄 Steps to reproduce the issue.

After creating the LXC using the command provided I navigate the address shown after the installation completes.
bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/dotnetaspwebapi.sh)"

Error is displayed.
502 Bad Gateway
nginx/1.24.0 (Ubuntu)

Image

Paste the full error output (if available).

Tail of /var/log/nginx/error.log

2025/02/20 12:44:36 [error] 256#256: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.20.5, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "192.168.20.154"
2025/02/20 16:36:02 [error] 256#256: *4 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.20.5, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "192.168.20.154"
2025/02/20 16:36:02 [error] 256#256: *4 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.20.5, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "192.168.20.154"
2025/02/20 16:36:03 [error] 256#256: *4 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.20.5, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "192.168.20.154"
2025/02/20 18:44:26 [error] 256#256: *9 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.20.5, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "192.168.20.154"

🖼️ Additional context (optional).

No response

Originally created by @JeepNWilly on GitHub (Feb 22, 2025). ### ✅ Have you read and understood the above guidelines? Yes ### 📜 What is the name of the script you are using? Dotnet ASP Web API LXC ### 📂 What was the exact command used to execute the script? bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/dotnetaspwebapi.sh)" ### 📝 Provide a clear and concise description of the issue. I have installed the LXC a few times and I keep getting. 502 Bad Gateway nginx/1.24.0 (Ubuntu). What I see in the error.log is as follows. 2025/02/20 12:44:36 [error] 256#256: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.20.5, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "192.168.20.154" ### ⚙️ What settings are you using? - [x] Default Settings - [ ] Advanced Settings ### 🖥️ Which Linux distribution are you using? Ubuntu 24.04 ### 🔄 Steps to reproduce the issue. After creating the LXC using the command provided I navigate the address shown after the installation completes. bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/dotnetaspwebapi.sh)" Error is displayed. 502 Bad Gateway nginx/1.24.0 (Ubuntu) ![Image](https://github.com/user-attachments/assets/9a1440e8-78e4-471b-b54d-077b299b6be4) ### ❌ Paste the full error output (if available). Tail of /var/log/nginx/error.log 2025/02/20 12:44:36 [error] 256#256: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.20.5, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "192.168.20.154" 2025/02/20 16:36:02 [error] 256#256: *4 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.20.5, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "192.168.20.154" 2025/02/20 16:36:02 [error] 256#256: *4 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.20.5, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "192.168.20.154" 2025/02/20 16:36:03 [error] 256#256: *4 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.20.5, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "192.168.20.154" 2025/02/20 18:44:26 [error] 256#256: *9 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.20.5, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "192.168.20.154" ### 🖼️ Additional context (optional). _No response_
OVERLORD added the not a script issue label 2026-02-04 19:39:59 +03:00
Author
Owner

@bvdberg01 commented on GitHub (Feb 22, 2025):

I quickly put together a guide based on how it seems to work for me. Could you check if this helps? If not, could you describe the steps you took after creating the LXC?

Dotnet ASP.NET Web Server - Post Install

@bvdberg01 commented on GitHub (Feb 22, 2025): I quickly put together a guide based on how it seems to work for me. Could you check if this helps? If not, could you describe the steps you took after creating the LXC? [Dotnet ASP.NET Web Server - Post Install](https://github.com/community-scripts/ProxmoxVE/discussions/2556)
Author
Owner

@JeepNWilly commented on GitHub (Feb 23, 2025):

I quickly put together a guide based on how it seems to work for me. Could you check if this helps? If not, could you describe the steps you took after creating the LXC?

Dotnet ASP.NET Web Server - Post Install

Thank you, I will give your tutorial a try either later tonight or tomorrow and will reply with my results. I created the LXC by using the command below and choosing Default Settings option. I recreated it today just in case there was a recent update.
bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/dotnetaspwebapi.sh)"

@JeepNWilly commented on GitHub (Feb 23, 2025): > I quickly put together a guide based on how it seems to work for me. Could you check if this helps? If not, could you describe the steps you took after creating the LXC? > > [Dotnet ASP.NET Web Server - Post Install](https://github.com/community-scripts/ProxmoxVE/discussions/2556) Thank you, I will give your tutorial a try either later tonight or tomorrow and will reply with my results. I created the LXC by using the command below and choosing Default Settings option. I recreated it today just in case there was a recent update. bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/dotnetaspwebapi.sh)"
Author
Owner

@JeepNWilly commented on GitHub (Feb 23, 2025):

I quickly put together a guide based on how it seems to work for me. Could you check if this helps? If not, could you describe the steps you took after creating the LXC?

Dotnet ASP.NET Web Server - Post Install

I followed your steps in the link and redeployed a new LXC using the same Assembly name and I still see the same 502 Bad Gateway
nginx/1.24.0 (Ubuntu). I feel that nginx is not properly configured. No sure what should the configuration show in the file /etc/nginx/sites-available/default

root@dotnetaspwebapi:# cat /etc/nginx/sites-available/default
map $http_connection $connection_upgrade {
"
*Upgrade" $http_connection;
default keep-alive;
}
server {
listen 80;
server_name MyWebApp.com *.MyWebApp.com;
location / {
proxy_pass http://127.0.0.1:5000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
root@dotnetaspwebapi:~#

@JeepNWilly commented on GitHub (Feb 23, 2025): > I quickly put together a guide based on how it seems to work for me. Could you check if this helps? If not, could you describe the steps you took after creating the LXC? > > [Dotnet ASP.NET Web Server - Post Install](https://github.com/community-scripts/ProxmoxVE/discussions/2556) I followed your steps in the link and redeployed a new LXC using the same Assembly name and I still see the same 502 Bad Gateway nginx/1.24.0 (Ubuntu). I feel that nginx is not properly configured. No sure what should the configuration show in the file /etc/nginx/sites-available/default root@dotnetaspwebapi:~# cat /etc/nginx/sites-available/default map $http_connection $connection_upgrade { "~*Upgrade" $http_connection; default keep-alive; } server { listen 80; server_name MyWebApp.com *.MyWebApp.com; location / { proxy_pass http://127.0.0.1:5000/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } root@dotnetaspwebapi:~#
Author
Owner

@bvdberg01 commented on GitHub (Feb 23, 2025):

I quickly put together a guide based on how it seems to work for me. Could you check if this helps? If not, could you describe the steps you took after creating the LXC?
Dotnet ASP.NET Web Server - Post Install

I followed your steps in the link and redeployed a new LXC using the same Assembly name and I still see the same 502 Bad Gateway nginx/1.24.0 (Ubuntu). I feel that nginx is not properly configured. No sure what should the configuration show in the file /etc/nginx/sites-available/default

root@dotnetaspwebapi:# cat /etc/nginx/sites-available/default map $http_connection $connection_upgrade { "*Upgrade" $http_connection; default keep-alive; } server { listen 80; server_name MyWebApp.com *.MyWebApp.com; location / { proxy_pass http://127.0.0.1:5000/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } root@dotnetaspwebapi:~#

So your Assembly name is: MyWebApp ?
And what version of .NET is the application you try to publish?

@bvdberg01 commented on GitHub (Feb 23, 2025): > > I quickly put together a guide based on how it seems to work for me. Could you check if this helps? If not, could you describe the steps you took after creating the LXC? > > [Dotnet ASP.NET Web Server - Post Install](https://github.com/community-scripts/ProxmoxVE/discussions/2556) > > I followed your steps in the link and redeployed a new LXC using the same Assembly name and I still see the same 502 Bad Gateway nginx/1.24.0 (Ubuntu). I feel that nginx is not properly configured. No sure what should the configuration show in the file /etc/nginx/sites-available/default > > root@dotnetaspwebapi:~# cat /etc/nginx/sites-available/default map $http_connection $connection_upgrade { "~*Upgrade" $http_connection; default keep-alive; } server { listen 80; server_name MyWebApp.com *.MyWebApp.com; location / { proxy_pass http://127.0.0.1:5000/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } root@dotnetaspwebapi:~# So your Assembly name is: MyWebApp ? And what version of .NET is the application you try to publish?
Author
Owner

@JeepNWilly commented on GitHub (Feb 24, 2025):

MyWebApp I the simple tutorial MS has. I cannot even show a standard html file on there. I have manually installed Ubuntu and nginx and I am able to get the default page but not sure why this install does not even show the nginx default page.
Maybe this will help.
If I edit the file /etc/nginx/sites-available/default and comment out the line that says "proxy_pass http://127.0.0.1:5000/;" I get the default nginx page
Any idea what that proxy_pass line should be?
Image

@JeepNWilly commented on GitHub (Feb 24, 2025): MyWebApp I the simple tutorial MS has. I cannot even show a standard html file on there. I have manually installed Ubuntu and nginx and I am able to get the default page but not sure why this install does not even show the nginx default page. Maybe this will help. If I edit the file /etc/nginx/sites-available/default and comment out the line that says "**proxy_pass http://127.0.0.1:5000/;**" I get the default nginx page Any idea what that proxy_pass line should be? ![Image](https://github.com/user-attachments/assets/a63be8b6-8b0b-4072-9024-df99b443039c)
Author
Owner

@JeepNWilly commented on GitHub (Feb 24, 2025):

Looking at the .net tutorial app it is a .NET 8.0

@JeepNWilly commented on GitHub (Feb 24, 2025): Looking at the .net tutorial app it is a .NET 8.0
Author
Owner

@bvdberg01 commented on GitHub (Feb 24, 2025):

Looking at the .net tutorial app it is a .NET 8.0

Then I think that is the problem, because when installing the ASP LXC only .NET 9.0 is installed.
For testing you can try to install 8.0 with apt-get install dotnet-sdk-8.0

@bvdberg01 commented on GitHub (Feb 24, 2025): > Looking at the .net tutorial app it is a .NET 8.0 Then I think that is the problem, because when installing the ASP LXC only .NET 9.0 is installed. For testing you can try to install 8.0 with `apt-get install dotnet-sdk-8.0`
Author
Owner

@JeepNWilly commented on GitHub (Feb 24, 2025):

Looking at the .net tutorial app it is a .NET 8.0

Then I think that is the problem, because when installing the ASP LXC only .NET 9.0 is installed. For testing you can try to install 8.0 with apt-get install dotnet-sdk-8.0

wow, that was it, I ran apt-get install dotnet-sdk-8.0 and the tutorial site loaded. Thanks for your patience and help.

Now since this LXC was created by specifying MyWebApp Assembly would I be able to host multiple ASP.net Websites or is this LXC tied to one web app? I currently use IIS on Windows 2022 VM in my Proxmox and would love to move away from IIS to Linux.

Image

@JeepNWilly commented on GitHub (Feb 24, 2025): > > Looking at the .net tutorial app it is a .NET 8.0 > > Then I think that is the problem, because when installing the ASP LXC only .NET 9.0 is installed. For testing you can try to install 8.0 with `apt-get install dotnet-sdk-8.0` wow, that was it, I ran apt-get install dotnet-sdk-8.0 and the tutorial site loaded. Thanks for your patience and help. Now since this LXC was created by specifying MyWebApp Assembly would I be able to host multiple ASP.net Websites or is this LXC tied to one web app? I currently use IIS on Windows 2022 VM in my Proxmox and would love to move away from IIS to Linux. ![Image](https://github.com/user-attachments/assets/fb784244-c8fd-45a9-a833-8d67c2fe4f61)
Author
Owner

@michelroegl-brunner commented on GitHub (Feb 24, 2025):

I dont now the App tbh, but i guess it should be possible? But you need to consult the Windows docs here.
Another option is to create a LXC for every .Net App.

@michelroegl-brunner commented on GitHub (Feb 24, 2025): I dont now the App tbh, but i guess it should be possible? But you need to consult the Windows docs here. Another option is to create a LXC for every .Net App.
Author
Owner

@JeepNWilly commented on GitHub (Feb 24, 2025):

I dont now the App tbh, but i guess it should be possible? But you need to consult the Windows docs here. Another option is to create a LXC for every .Net App.

Yeah, I will do some more digging in the nginx side but all and all I am very happy that this community was able to help me out.

@JeepNWilly commented on GitHub (Feb 24, 2025): > I dont now the App tbh, but i guess it should be possible? But you need to consult the Windows docs here. Another option is to create a LXC for every .Net App. Yeah, I will do some more digging in the nginx side but all and all I am very happy that this community was able to help me out.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ProxmoxVE#537