Skip to content

Latest commit

 

History

History
65 lines (53 loc) · 1.92 KB

02-custom-url-port.md

File metadata and controls

65 lines (53 loc) · 1.92 KB
layout title parent nav_order
default
Configure custom url and http port
Home
2

Configure a custom url and http port

{: .no_toc } In this chapter we'll discuss how to configure Apache web server to redirect the homepage from http://owncloud_ip/owncloud/ to http://owncloud_ip:custom_port.
In this example we are going to be using the IP address 192.168.0.105 and tcp port 8080 (http://192.168.0.105:8080).

Table of contents

{: .no_toc .text-delta }

  • TOC {:toc}

Configure httpd to listen on port 8080

Backup the current /etc/httpd/conf/httpd.conf and change Listen 80 to Listen 192.168.0.105:8080.

cd /etc/httpd/conf/ && cp -p httpd.conf httpd.conf.bck && sed -i 's/^Listen 80$/Listen 192.168.0.105:8080/' httpd.conf

Save and close the file.

Create a VirtualHost to redirect the homepage

Paste the following on your terminal as root in order to create the VirtualHost:

vhost="/etc/httpd/conf.d/owncloud.conf"
/bin/cat <<EOF >$vhost
<VirtualHost 192.168.0.105:8080>
  ServerName owncloud.mylab.local
  DocumentRoot /var/www/html/owncloud
  ErrorLog logs/owncloud_error_log
  CustomLog logs/owncloud_access_log combined
</VirtualHost>
EOF

You may want to check if the syntax of the configuration is correct with the following command:

apachectl configtest

vhost verification

Now restart Apache to make these changes take effect.

systemctl restart httpd

Allow port 8080 through the Firewall

firewall-cmd --permanent --zone=public --add-port=8080/tcp
firewall-cmd --reload

Now you should be able to access your ownCloud server pointing your browser to http://owncloud_ip:8080 Completed

Next steps

To add a new user to ownCloud, see "Adding users".