C
C#

help

✅ Hosting Asp.Net Core 3.1 website on Ubuntu VPS

RREAPER2/4/2023
Hi, I've been trying to host my website on my Ubuntu 20.04 Cloud VPS but when I try using the command sudo systemctl start scuffed.service the status keeps giving me this error: ExecStart=/usr/bin/dotnet /root/Website/ScuffedManagerWeb.dll (code=exited, status=217/USER) I can see the files in their path locations but maybe I've messed up somewhere anyways rooF If anyone out there got any experience hosting websites then please post in here or feel free to DM me. rooHappy scuffed.service looks like this:
[Unit]
Description=scuffed-manager

[Service]
WorkingDirectory=/root/Website
ExecStart=/usr/bin/dotnet /root/Website/ScuffedManagerWeb.dll
Restart=always
RestartSec=10
SyslogIdentifier=REAPER
User=REAPER

[Install]
WantedBy=multi-user.target
[Unit]
Description=scuffed-manager

[Service]
WorkingDirectory=/root/Website
ExecStart=/usr/bin/dotnet /root/Website/ScuffedManagerWeb.dll
Restart=always
RestartSec=10
SyslogIdentifier=REAPER
User=REAPER

[Install]
WantedBy=multi-user.target
HHenkypenky2/4/2023
upon some quick google searching 217 means the user doesn't exist at the time service tried to start do you have some logs?
Ccanton72/4/2023
Checked the logs? journalctl -ru scuffed Can you run it normally from the command line? Or yeah, doss the user REAPER exist on your system?
RREAPER2/5/2023
If I type dotnet /root/Website/ScuffedManagerWeb.dll then it starts the website.
RREAPER2/5/2023
This is the log I'm getting when typing journalctl -ru scuffed
HHenkypenky2/5/2023
is your user REAPER like this?
RREAPER2/5/2023
To be honest I'm not 100% sure
HHenkypenky2/5/2023
show me console what does it say
RREAPER2/5/2023
Like this? root@somethingcp-7176:~# journalctl -ru scuffed
HHenkypenky2/5/2023
you are using root as the user
RREAPER2/5/2023
Oh...
HHenkypenky2/5/2023
please type this awk -F: '{ print $1}' /etc/passwd wait
RREAPER2/5/2023
That makes more sense then...
HHenkypenky2/5/2023
yes type that or this cut -d: -f1 /etc/passwd
RREAPER2/5/2023
What does it do?
HHenkypenky2/5/2023
lists all users
RREAPER2/5/2023
HHenkypenky2/5/2023
no REAPER user
RREAPER2/5/2023
So I should just change REAPER to root in the service file?
HHenkypenky2/5/2023
just remove it and it will run as root
RREAPER2/5/2023
Ok thanks, I'll try that
Ccanton72/5/2023
Although, you probably don't want to run it as root. Create a dedicated user for it
HHenkypenky2/5/2023
yeah also that
RREAPER2/5/2023
How do I make a user then? rooThink
RREAPER2/5/2023
Ok so I added a new user named "REAPER" and kept the User = REAPER in my scuffed.service. Then I did sudo systemctl daemon-reload => sudo systemctl start scuffed.service => sudo systemctl status scuffed.service and it gives me this new error rooThink scuffed.service - scuffed-manager Loaded: loaded (/etc/systemd/system/scuffed.service; enabled; vendor preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Sun 2023-02-05 01:16:09 CET; 6s ago Process: 1528970 ExecStart=/usr/bin/dotnet /root/Website/ScuffedManagerWeb.dll (code=exited, status=200/CHDIR) Main PID: 1528970 (code=exited, status=200/CHDIR)
HHenkypenky2/5/2023
that means the user doesn't have permissions i thinik
RREAPER2/5/2023
I was just reading up on it as well and I came to the same conclusion Btw I just tried to run the website with the root user and it works rooHappy really sure how to give the REAPER user permissions though 😅
HHenkypenky2/5/2023
just run it like services by default for now while your read more on linux and some of it's weird ways that take time to get used to
RREAPER2/5/2023
Yeah read something about groups and stuff and it seemed a bit complicated for now 🙂 Thanks a lot for the help 😄 Is Apache2 a good way to host a website? Or are there some better ways to use?
HHenkypenky2/5/2023
depends on the app i would say: apache: more flexibility, feature rich, large volume of traffic nginx: faster, lightweight, scalable
Jjcotton422/5/2023
it's failing b/c non-root users aren't allowed to be in root's home folder
RREAPER2/5/2023
When hosting through Apache2, how long does it usually take before I can see the website on my own computer? rooThink I'm asking because I'm not sure if my website is setup correctly or if it just takes time before it's live
AAngius2/5/2023
Apache should just work immediately The DNS resolvers might take some time to register your domain, though
RREAPER2/5/2023
How does it work again with domains. I have to pay for one right? Or is it possible to have a name for free rooThink
AAngius2/5/2023
Yeah, you need to pay a yearly fee
RREAPER2/5/2023
That might be my problem then... There aren't any weird .ladwl to have at the end to get a free domain?
AAngius2/5/2023
Uh, there's Freenom I guess But they can just revoke your domain at any time And direct it to a page with ads So not really trustworthy lol
AAngius2/5/2023
Domains aren't expensive, tho
RREAPER2/5/2023
I guess you got a point there rooThink so let's say I buy the domain "scuffed-manager.shop". Do I then just have to change my Apache2.conf file? Because I feel like there got to be some kind of login to prove you're the owner of the domain (I just don't want to buy a domain and not know how to use it 😅).
AAngius2/5/2023
Plenty of tutorials around, you'll surely find something
RREAPER2/5/2023
So it's not too advanced?
AAngius2/5/2023
Nah, super simple
RREAPER2/5/2023
Ok, thanks I'll try looking into it 😄 Oh yeah one more thing. The price of this domain is 1,78 dollars but if I buy 2 years the price goes to 32,76 dollars. Does this mean that there's a discount on the first year or is it to prevent people locking on to a domain for a low price without having a chance of losing it? Seems a bit weird to me rooThink
AAngius2/5/2023
Some registrars, yeah, lure you in with low initial prices and then raise them Cloudflare will offer constant prices The registrars that offer initial discount are cool if you need a domain for some small project for a year or so But after that... they can get really expensive Google Domains is another registrar that's trustworthy and doesn't discount the first year Cloudflare is the cheapest tho
RREAPER2/5/2023
This website is just a small one which is being used by me and 2 others to select movies on 😅 So I'm thinking if it might be worth going for a 1 year domain and then just switching to a new domain name rooThink
AAngius2/5/2023
Yeah, that would work lol Or you could try just using the IP maybe
RREAPER2/5/2023
But I'm struggling to find the prices on CloudFlare domains rooKek
AAngius2/5/2023
Need to log in first, go to registrar in the left menu
RREAPER2/5/2023
Dumb question but how do I use the ip? Is that just to replace the domain name in my conf files with the vps ip? rooThink
AAngius2/5/2023
Enter domain name, press enter, will show all available TLDs and prices Yeah http://123.456.78.90
RREAPER2/5/2023
Let me try and see if that works because I'm very curious if my setup actually works 😉 To find my ip I just have to type ifconfig and find get the number from inet right?
AAngius2/5/2023
Probably? It's the IP you use to SSH into the server Might need to add the port too
HHenkypenky2/5/2023
if you have a credit card you can get 200 bucks on azure for free, which should give you hosting for about a year for free they give you subdomain in the form of: foo.azurewebsites.net with ssl and everything
RREAPER2/5/2023
That might be a solution as well. Right now it won't even show me the website if I'm running it on ip instead of a domain name 😅 Slowly dying inside
HHenkypenky2/5/2023
azure is very easy, if you get that, you press one button on visual studio and your app gets published in like 10 seconds or rider
RREAPER2/5/2023
The are very pricy after that 1 year right?
HHenkypenky2/5/2023
50 bucks a month i think for the basic tier
RREAPER2/5/2023
Jeez
HHenkypenky2/5/2023
but that year is enough for you to start then you can migrate somewhere else
RREAPER2/5/2023
Was kind of hoping for a more steady solution now, so I don't have to think about it in the future 😅 Plus I think I used my credits on a Discord bot some years ago, so I'm not sure if there's any credits left rooF
HHenkypenky2/5/2023
what's your budget? per month
RREAPER2/5/2023
I'm not entirely sure but I would probably say as low as possible 😅
HHenkypenky2/5/2023
so like 10 bucks?
RREAPER2/5/2023
What are we talking about here? 10 bucks for a domain or a vps to host on?
HHenkypenky2/5/2023
vps hosting
RREAPER2/5/2023
I already got one of those which I'm hosting my Discord bot on and was hoping to host my website on that as well It's sadly not from Azure so I can't use the easy setup system they got rooCry on the other hand it's only 4 euro each month
HHenkypenky2/5/2023
read what ZZ said again there lies the key
RREAPER2/5/2023
I'm pretty sure I haven't setup a SSH, that's not a requirement right? I tried changing the domain name in my files to my ip and in my browser i searched for: http://{ip}:{different ports} and I wasn't able to find it rooThink (different ports because I'm not 100% sure about what port it uses but it should be allowing multiple once in the firewall)
AAccord2/6/2023
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Looking for more? Join the community!

Want results from more Discord servers?
Add your server
Recommended Posts
Fibonacci in recursive ?So I have made 2 versions of Fibonacci calculator, one is in normal way and one is in recursive ```✅ trying to get html linksi am trying to get links with only html types any ideas how?✅ Help with absorbing basic concepts learnedI've recently completed (sort of, I already learned the last module myself earlier) the C# course avObject that's passed in isn't recognized as an object?```cs using System; using System.Collections.Generic; class Program { public static void Main (st❔ .Net Maui [Problem with Tab from TabBar]So i have a css and a tabbar with 2 tabs in it both linked to a css styling file yet i can't seem to❔ Calling async methodHi guys. I tried to call this AzureAPI class in main program. But I got a error. I want to call thibuild errors in my functioni want to call the function until the loop ends but its giving me build errors that I'm not 100% sur❔ View cannot be found.LoginModel.cs Pages/Account/Login.cshtml Pages/Account/Register.cshtml AccountController.cs attache❔ Unsupported Media Type - Razor page```{"type":"https://tools.ietf.org/html/rfc7231#section-6.5.13","title":"Unsupported Media Type","st✅ JsonConvert debugging helpHello! I'm having a hard time figuring out how to solve an issue where JsonConvert.DeserializeObject❔ Make a sprite follow mouse while pivoting around character in UnityHi, I its hard to describe my issue by describing it since im not sure exactly what I'm looking for ❔ is Generic Repository a bad implementation of Repository Pattern?Surfing the internet I have found several articles that say it is an anti-pattern because it is an a❔ Problems with using Dotnet 6 on Windows to publish to an exe formatDotnet/C# newb here. Previously I've only done a small amount of development using the **.Net Framew❔ Using net7 documentation while targeting netstandard2.0This might be a bit of a dumb question, but is there anyway to make omnisharp/roslyn's tooltips use ❔ WPF app unit testingI am learning how to make unit tests. I built my app on .net core 6.0 and I created class library (o❔ where exactly should i put authorizationso i read a few posts on where to put authorization and most of the people agree on putting it in th❔ C# WPF playing background musicHello, I have WPF app for game launcher/updater. I wanted to add background music, so I added this cC# wpf mvvm Datagrid filter using LINQSo here I have a MVVM form. the Form contains a Datagrid which is connected to the Databank. I also ❔ Is it worth to create lazy dictionary in this case?I have following class: so as you see Add function add to the dictionary class TreeNode, it looks li❔ Going to use a listbox with a switch for something in the morning, need help with format for bothI would like to set two variables with a listbox using a switch and one variable with a second listb