Help with apache config

I've been working on an install script for my debian homeserver. ( https://forum.level1techs.com/t/bash-install-script-for-my-servers/111093 ) Christmas and school has taken it's toll though and it was put on ice after several failed attempts to make apache work. (I fail on the config in a way that keeps it from starting)

What I want apache to do is maintain Nextcloud on port 443 with a redirect from port 80 (in the root url and not /nextcloud which I suspect is the default) and share a directory " /srv/html " on port 83 so that I can download files from it whenever and wherever (I intend to keep only symlinks to other files in that dir thus follow symlinks true).

In my other script I attempt to use radicale. I have now instead opted for nextcloud for DAV and other features.

if you look at the plex server guide on here that one of the other forum members posted that explains how to redirect pages to the root address, including port routing. sorry i dont have the link but a quick search should find it for you.

1 Like

Thanks. I'll have a look at that. Now only the directory share on port 83 remains.

If you want to use a different port (not the same like for the rest of the site) then you need a new <VirtualHost> for that. I recommend putting something like this into a new file in /etc/apache2/site-available and then running sudo a2ensite <filename> (without the angle brackets of course) afterwards. However this is not strictly necessary and you might prefer keeping it all in one file, if it makes more sense for your setup.

<VirtualHost *:83>
ServerName your-server.domain.com
ServerAlias www.your-server.domain.com
DocumentRoot /srv/html
</VirtualHost>

This will create a simple HTTP server on port 83 that is available on any IP address that your machine has. If you only want to listen on a specific IP address, you can replace the asterisk with that IP address.
The ServerAlias directive is not strictly necessary, but I usually keep it for the group of people who still thinks that the internet doesn't work without it ;-)
However, keep in mind that this is more of a minimal working configuration and depending on what type of site you want to serve, you might want to add a few options, like for example a <Directory> directive.

2 Likes

Perfect! Thanks!

But don't I need to enable port 83 somewhere else? There is an active ip file in the config directory

Sorry, I forgot that part. Yes, you do need to tell Apache to listen on that port too. You can do that by adding Listen 83 at the beginning of your configuration file.

1 Like

All done and working now. Merely some fiddling with the ssl site-version remaining that i expect to take care of myself.

Thank you all for the help!

1 Like