0

Hi i want to change port in apache2. i was running owncloud on standard ports http=80 https=443. For some reasons i need to change https port from 443 to 8443. i have seen many solutions but i dont come to hundred percent result what i want. i just want that when i write my hostname "server" then i just see my owncloud page. when i write my ipadress then i no need to mention port number but when i write "server" then i need to mention port number 8443 then it works. i am using Ubuntu 16.04 LTS. i have tried everything on virtualhost and also by ports.conf. kindly tell me some solution if someone know .Thanks in advance

3

Browser knows default ports (80, 443). http:// is also default. So when you write

server

Your browser actually makes a request

http://server:80/

If you type in

https://server/

Your browser will make a request

https://server:443/

In fact it is a little more complicated, because you cannot access the network name directly. Browser finds out IP of the server and makes request

http://<ip of server>:80/

and tells the server that the request is for server, because you can host also server1, server2,... on the same IP address.

You will not be able to make browser to request port 8443 by default. You will have to write it in the address.

The problems you are describing are not all clear to me, but it looks like they are all connected with apache configuration and the inability of browser to go to 8443 port by default.

When you have VirtualHost defined in apache, you must specify ServerName. Clients will arrive to the IP of server, but apache needs to know which server name was requested to send back the correct pages. If you access server only with IP the name will not be sent to apache and it will send back the default pages. I suspect that is happening in your case, because you say that browsing to IP works. I would suspect it works to default port numbers.

I hope I helped to clear out the questions at least a bit.

2
  • you mean to say there is no possibility that i just write server (without port number ) to come to the owncloud page? if yes than what would be your method csn please write it here. because if i just write my ipadress then i no need to mention port number. – nusrat Apr 23 '18 at 10:32
  • 1
    You can just write your server name if you stay on standard ports or if you make a redirection. But that would mean that apache would still work on standard ports. On standard port it would just redirect to non-standard. You could make it listen on port 80 and then redirect to 8443. Take a look here httpd.apache.org/docs/2.4/vhosts/examples.html to understand ports, IPs and names. Look here for redirect wiki.apache.org/httpd/RedirectSSL – nobody Apr 23 '18 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.