✅ Hosting Asp.Net Core 3.1 website on Ubuntu VPS
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
If anyone out there got any experience hosting websites then please post in here or feel free to DM me. 70 Replies
My scuffed.service looks like this:
upon some quick google searching 217 means the user doesn't exist at the time service tried to start
do you have some logs?
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?If I type
dotnet /root/Website/ScuffedManagerWeb.dll
then it starts the website.This is the log I'm getting when typing
journalctl -ru scuffed
is your user REAPER
like this?
To be honest I'm not 100% sure
show me console
what does it say
Like this?
root@somethingcp-7176:~# journalctl -ru scuffed
you are using root
as the user
Oh...
please type this
awk -F: '{ print $1}' /etc/passwd
wait
That makes more sense then...
yes
type that
or this
cut -d: -f1 /etc/passwd
What does it do?
lists all users
no REAPER
user
So I should just change REAPER to root in the service file?
just remove it
and it will run as root
Ok thanks, I'll try that
Although, you probably don't want to run it as root. Create a dedicated user for it
yeah also that
How do I make a user then?
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
● 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)that means the user doesn't have permissions i thinik
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 really sure how to give the REAPER user permissions though 😅
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
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?
depends on the app
i would say:
apache: more flexibility, feature rich, large volume of traffic
nginx: faster, lightweight, scalable
it's failing b/c non-root users aren't allowed to be in root's home folder
When hosting through Apache2, how long does it usually take before I can see the website on my own computer?
I'm asking because I'm not sure if my website is setup correctly or if it just takes time before it's live
Apache should just work immediately
The DNS resolvers might take some time to register your domain, though
How does it work again with domains. I have to pay for one right? Or is it possible to have a name for free
Yeah, you need to pay a yearly fee
That might be my problem then...
There aren't any weird .ladwl to have at the end to get a free domain?
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
Domains aren't expensive, tho
I guess you got a point there 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 😅).
Plenty of tutorials around, you'll surely find something
So it's not too advanced?
Nah, super simple
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
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
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
Yeah, that would work lol
Or you could try just using the IP maybe
But I'm struggling to find the prices on CloudFlare domains
Need to log in first, go to registrar in the left menu
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?
Enter domain name, press enter, will show all available TLDs and prices
Yeah
http://123.456.78.90
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?Probably?
It's the IP you use to SSH into the server
Might need to add the port too
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
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
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
The are very pricy after that 1 year right?
50 bucks a month i think
for the basic tier
Jeez
but that year is enough for you to start
then you can migrate
somewhere else
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
what's your budget?
per month
I'm not entirely sure but I would probably say as low as possible 😅
so like 10 bucks?
What are we talking about here? 10 bucks for a domain or a vps to host on?
vps
hosting
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 on the other hand it's only 4 euro each month
read what ZZ said again
there lies the key
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
(different ports because I'm not 100% sure about what port it uses but it should be allowing multiple once in the firewall)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.