Installed Server Edition using Linode StackScript, how do I change the port

everywhere I read it says to add it “-port <number>” to the startup script

Where is the startup script? I’m only used to rc.local and that’s empty

Also, I need to host other web pages - Do I need to install a 2nd webserver?

thanks

The script on Linode will launch Manager Server on port 8080 and Caddy Webserver on 80 and 443.

In other words, you don’t need to change the port as Manager Server will be accessible on both 80 and secure port 443 with automatically installed SSL certificate.

Installation script for Linode, Digital Ocean, Vultr etc. is here http://install.manager.io/

So you can see what it does.

Thanks for the startup script, that’s neat, but I don’t understand all of it

But as I said, I need to host multiple things besides just this, therefore I’d like it on a different port. Plus, I don’t want my accounting software on port 80, that’s a highway for attack.

So again I ask: How do I change the port?

The installation script will redirect from 80 to secure 443. It won’t let you access Manager from port 80.

If you want to use the server for other stuff too, then you have to install the server manually. Do not use install script (e.g. StackScript).

Here is how to install manually on Ubuntu
https://www.manager.io/server/installation/ubuntu

How can that possibly be true, can you explain in more detail? I have full access to the entire server, it should only be a matter of finding where the start script is.

As per install script, you can see it’s using Systemd to start server on launch. You will need to learn more about Ubuntu if you want to dive deeper into Systemd.

Or simply install Manager Server manually using the tutorial I have posted above. You can easily modify port during manual installation.

Okay thank you, that makes sense, systemd is new to 16.04 and im not used to it

i’ll look into modifying that thank you

@lubos

Okay, maybe you can help me from here

After some fiddling, I think I’m really close to figuring this out, but maybe I could use your help one more time.

The issue
http://mydomain.com = no response! yay! it stopped listening
http://mydomain.com:81 = connection refused
https://mydomain.com = connection refused
I am willing to accept an imperfect SSL connection. I will be the only person using this. I just really would like it not listening on port 80.

The following configs are the only things I’ve change since the default install

$ vim /etc/systemd/system/manager-server.service
[Unit]
After=network.target

[Service]
LimitNOFILE=1048576
ExecStart=/usr/bin/mono /usr/share/manager-server/ManagerServer.exe -port 81
Restart=on-failure
StartLimitInterval=600

[Install]
WantedBy=multi-user.target

And also

$ vim /etc/systemd/system/caddy.service
[Unit]
After=network.target

[Service]
LimitNOFILE=1048576
ExecStart=/usr/local/bin/caddy -agree=true -port=81 -http-port=81 -conf=/usr/share/manager-server/caddy.conf
Restart=on-failure
StartLimitInterval=600

[Install]
WantedBy=multi-user.target

And lastly

$ vim /usr/share/manager-server/caddy.conf
:443 {
  proxy / localhost:81
  tls { max_certs 100 }
}

So what do you think I’m missing to get my server to successfully work for forwarding port 81 to 443?

Thanks again

You cannot run Manager Server and Caddy on the same port.

Typically you’d run Caddy on port 443 and Manager Server on different port such as 8080.

Then Caddy config file would instruct all traffic from port 443 to be redirected to localhost:8080 (where Manager Server runs).

Get rid of -port=81 -http-port=81 arguments. Let Caddy run on both 443 and 80. If you don’t want anybody to access port 80, then set up appropriately firewall.

Although I’m not sure why you are so scared of port 80. It’s irrational. Caddy will redirect all traffic from unsecured port 80 to secured port 443. Literally every website on the Internet is doing it this way.

Because I want to host a normal website on port 80

Regarding the manual installation Ubuntu
Looking through that doesn’t really show me how set up a custom port either. There’s no place to specify the port, so even if I did erase my Linode and do a manual install, I would run into the same problem again.

I’m not sure whether Caddy can obtain automatic SSL certificate if it doesn’t listen on port 80. You will need to research this.

I think the best way is to make Caddy available on both ports 80 and 443. Then use Caddy config file to redirect traffic either to ManagerServer or other webservers based on the domain name.

This is not usually what I recommend since now you will need to dig deeper into how to setup Caddy config files. Considering you can have Linux VPS from just $5 per month, why not give ManagerServer the whole VPS?

On the other hand, Caddy is such a good software so learning it is definitely not a waste of time. It will give automatic SSL to all your webservers/websites, not just ManagerServer.

If you don’t specify any port for ManagerServer, it will run on port 8080 by default. This is usually OK.

If you want to specify different port, use -port argument.

mono ManagerServer.exe -port 12345

Okay, so you’re saying I can use Caddy to host other websites besides just Manager?

Also, I don’t have the $5 a month VPS, I use the $40 with 8GB ram 4 core 3ghz CPU

You said
“If you want to specify different port, use -port argument.
mono ManagerServer.exe -port 12345”

Is that not what I did in my previous post when attempting to set it to port 81?
Also when you say it runs on port 8080 by default, the default stackscript does not resolve on port 8080 with no configuration, it only resolves on 80 and 443.

Having said this I feel like I am having a disconnecting with the logical distinction between the manager software and the web server. It feels like if you were running a website on an apache server, you specify apache’s listening port and then additionally specifying what port your website listens on, which obviously doesn’t make any sense because you don’t specify what port a website listens on, just the server which serves it. So it feels like Caddy should be serving Manager, so I don’t know what the manager port is listening for. Maybe if you could please explain the difference between manager and caddy and their listening ports, things will be a little more clear for me. Also the .exe running on linux with a distinct lack of wine is a bit confusing as well

thank you again

Yeah. By the way, Caddy is not required for Manager Server. Manager Server itself is a web-server (like Apache). Caddy just makes it super easy to have Manager Server automatically behind HTTPS.

Yeah, but if you make Caddy to listen on port 81 as well, then Manager Server will fail to start.

I would need to test this but Manager Server should be listening on port 8080 so you can access it directly without going through Caddy.

Going through Caddy is more secure because you get automatic SSL connection.

But Caddy is not required for Manager Server. Before Caddy, people were using Apache or Nginx to make Manager Server accessible via HTTPS.

If you don’t care about Manager Server being accessible via HTTPS, then you don’t need Caddy, Apache nor Nginx.

Just make Manager Server to run on whatever port you like and access it over the Internet without Caddy, Apache or Ngnix. That would be the first step.

This makes SO much sense, I think I get it it now! Thank you!

Very well explained. I jumped through these obstacles though, by hosting Linode through Cloudways (www.cloudways), suffice to say it was a very good decision.