Change port 443 and 80

I need to change port 80 and 443 to something else for Nextcloud (Apache) and I just need to have my own solution confirmed or corrected.

  1. I change port 443 to 8443 in /etc/apache2/sites-available/default-ssl.conf
  2. I change port 80 to 880 in /etc/apache2/sites-available/000-default.conf
  3. I change to ‘overwrite.cli.url’ => in /var/www/nextcloud/config/config.php
  4. Open port 880 and 8443 in my router

My address to my Nextcloud will then be

Does this looks right? I know this really is a question about Apache aside from the “‘overwrite.cli.url’ =>”-bit but I hope you could confirm or correct my thinking if I’m very nice :slight_smile:

1 Like

you will have to change the port in apache.conf as well
listen 8443

Thank you for your answer!
But the rest looks right?

I could not understand exactly where I should add the port number in apache. I have a apache2.conf but dont know where to set the port number. Maybe at the end of “ServerName” to “ServerName”?

In the apche2.conf there are referrals “ports.conf” and in that conf are port 80 and 443 set. Perhaps I need to change in ports.conf instead of apache2.conf?

I guess having your own cloud is not something for newbes. Read this how you will. i will stop asking questions here…


Unfortunately this is a forum supported in large by the community, so SLAs on responses can’t be offered :frowning:

What you’re asking isn’t a Nextcloud question, it’s help with Apache. That said:

  1. Edit /etc/apache2/ports.conf
    a. Change the port numbers as required or add new
  2. Edit /etc/apache2/sites-available/yournextcloud.conf
    a. Change 80/443 there to the ports in <VirtualHost *:80> (or 443) to what you specified in 1a.
  3. Restart Apache: sudo service apache2 restart