How can I setup an SSL?
hey there, im running the server on ubuntu 20.04, how can I install an SSL on it?
Also, how can I work on a dynamic website using the code server? Like have the codeserver on port 80 and the website on port 30
92 Replies
are you talking about code-server or coder ?
code-server
alright
you can use the --cert CLI argument
code-server --cert <path to certificate file>
alr... and how do i get a certification file?
using certbot -> https://certbot.eff.org/
aight
tx
is the cert file a .key file or a .crt file
actually
code-server --cert cert.crt --cert-key cert.key
i forgot the cert keykk
@Phorcys also how can I make it so the code-server only has rights to edit in the /var/www/html folder?
make it run as a user that only has permissions on this folder
alr, thanks
[2022-10-04T12:15:48.746Z] error listen EADDRINUSE: address already in use 127.0.0.1:80
when i try to run it on port 80
when i run it on any other port it times outare you running anything on port 80 ?
yes of course you are
apache
alright
i think i got an nginx server
nginx nginx
sure
it's whatever
altho i did do sudo systemctl stop nginx
i thought it was apache because of the /var/www/html
but anyways
wdym times out
err timeout when i try to access it on google
can you show me how you're running code-server on port 3000?
and then show me the error in chrome
i go to ip:port and it gives me err connection timeout
k
code-server --bind-addr 0.0.0.0:3000 --cert localhost.crt --cert-key localhost.key
@Phorcys
yeh
are you accessing it from the public ip ?
yes
did you port forward ?
the website on port 80 works just fine...
oh you might have firewall rules
ah yea thats why
lemme change that
nope, allowed the port and its still doing it
yeah so uh
i don't really have time
sorry for that
but i'm still pretty sure it's a firewall issue
aight ill go digging, thanks tho
try to curl https://localhost:3000 on the host
it should error because of the cert but it doesn't matter
aight
yea so its firewalls
@Phorcys i fixed the firewall issue.. im now getting this errror
NET::ERR_CERT_AUTHORITY_INVALID
did you use certbot ?
yes
i might have ran the wrong commands... lemme try again
thats the command i ran
@Phorcys
this has nothing to do with certbot lol
do you have a domain ?
no
yeah then just ignore the warning
there's nothing you can do about it
i got a subdomain
what is it
beta.sahara-app.com
1 sec generating an ssl for it
yo @Phorcys do u know if theres a way to install code-server on plesk obsidian?
no clue
and even if you could access a shell, you would be violating the hosting provider's ToS
how so?
I own the VPS
and I installed plesk obsidian on it
oh, I thought you were using a pre-installed plesk obsidian instance that only has for purpose to use plesk obsidian
what is plesk obsidian exactly?
not too sure its a bit similar to plesk
almost the exact same
I don't know what plesk is either lol
do you know what cPanel is?
yes
Plesk is a bit similar to that but I'd say its a bit more oriented towards re-selling hosting and has less limits.
oh okay
well idk
if you have shell access you can install it
I dont' know what you mean by "on plesk obsidian"
alright now it's installed what do I do?
actually ima re-install it i messed up
can u send link to a video plz or documentation to install it
I’m running code-server with nginx too, i might be of some assistance
So basically what i did was run code-server on any port that’s not in use by my server, which was 8080 by default. I updated the code-server config to the following:
The proxy-domain is what ultimately got code-server to listen to my public domain.
I didn’t set up code-server to use certs because i already did that with nginx, which works just fine
To access your web application running on localhost:30 you’ll have to configure the proxy in nginx, what i did in my nginx config is listen to anything in the following format: {number}.{domain} and then proxy reverse proxy that to code server (running on localhost:8080).
This is what that looks like:
Oh wait this is the domain itself^
I’ll send the proxy thing too
No that should just work, i have a separate block to allow http on only proxied ports, but this should do the trick if you’re running a web application and want to access it elsewhere with the code-server authentication
All you have to do now is visit 30.{domain} and log in, then you’ll be able to access your app running on localhost:30
Including working ssl
I don't think that's the issue though
Install - code-server v4.7.1 docs
How to install code-server.
How can I fix this error?
@Phorcys
how did you make this certificate ?
plesk
oh uh
wait no
try using a different browser
not even
not even
i know why
the domain is not the right one
in the cert
how do i fix this
can you do
systemctl status nginx
and show me the outputdo you have anything in your config loading the brotli module ?
something like
load_module modules/ngx_http_brotli_filter_module.so;
not that i know of...
well you should take a look
because that's what it is
can i delete it?
well you have to find it in the config first
it's complaining that the module doesn't exist
so it has somewhere in the config loading it
do you have a /etc/nginx/sites-enabled
yes
look for configs in there
thats the file in it
the only file in it
oh then
look in /etc/nginx/nginx.conf
thats all thats in it
hold on
run
grep -rnw "ngx_http_brotli_filter_module" "/etc/nginx"
i guess delete that file but it should not even impact
ok
done
does it start now
hm
no
@Phorcys
show me the systemctl status
yea no this isn't working out with plesk
im re-installing it fresh
marking this as resolved, had a vc with OP to guide him through the setup