ownCloud Tutorial Part 2: Configure custom URL and HTTP port

Share on:

Overview

Configure a custom url and http port

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).

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.

1cd /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:

 1vhost="/etc/httpd/conf.d/owncloud.conf"
 2/bin/cat <<EOF >$vhost
 3<VirtualHost 192.168.0.105:8080>
 4  ServerName owncloud.mylab.local
 5  DocumentRoot /var/www/html/owncloud
 6  ErrorLog logs/owncloud_error_log
 7  CustomLog logs/owncloud_access_log combined
 8</VirtualHost>
 9EOF
10

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

1apachectl configtest

vhost verification

Now restart Apache to make these changes take effect.

1systemctl restart httpd

Allow port 8080 through the Firewall

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

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

See Also


comments powered by Disqus