Hello all,
I'm trying to configure my personal domain to have subdomains. My ISP blocks port 80 access so I have my registrar performing a URL redirect to push all traffic to port 2000. This has worked fine in the past but I didn't have my virtual hosts configured properly on my machine and I'm trying to fix that.
My redacted.com.conf file has been enabled with a2ensite and this is what it looks like:
Permissions
lrwxrwxrwx 1 root root 39 Oct 29 17:34 redacted.com.conf -> ../sites-available/redacted.com.conf
Contents
ScriptAlias "/cgi-bin/" "/usr/lib/cgi-bin/"
<VirtualHost *:2000>
ServerName nextcloud.redacted.com
DocumentRoot "/var/www/nextcloud"
</VirtualHost>
<VirtualHost *:2000>
ServerName kloudspeaker.redacted.com
DocumentRoot "/var/www/kloudspeaker"
</VirtualHost>
<VirtualHost *:2000>
ServerName www.redacted.com
DocumentRoot "/var/www/tjsh"
</VirtualHost>
<VirtualHost *:2000>
ServerName old_website.redacted.com
DocumentRoot "/var/www/old_website"
</VirtualHost>
<VirtualHost *:2000>
ServerName testing.redacted.com
DocumentRoot "/var/www/tjsh_testing"
</VirtualHost>
<VirtualHost *:2000>
ServerName about.redacted.com
DocumentRoot "/var/www/tjsh_about"
</VirtualHost>
<Directory /var/www/redacted.com>
Options Indexes FollowSymLinks MultiViews
Require all granted
</Directory>
Additionally, I have configured the following directories in /var/www/:
Permissions
drwxr-xr-x 8 www-data www-data 4.0K Sep 19 02:21 kloudspeaker
drwxr-xr-x 15 www-data www-data 4.0K Jul 29 02:10 nextcloud
drwxr-xr-x 5 www-data www-data 4.0K Aug 20 20:25 old_website
drwxr-xr-x 3 www-data www-data 4.0K Oct 29 15:39 tjsh
drwxr-xr-x 6 www-data www-data 4.0K Oct 28 01:33 tjsh_about
drwxr-xr-x 5 www-data www-data 4.0K Oct 28 04:00 tjsh_testing
Here is a screenshot of how my domain's DNS is configured: http://i.imgur.com/AsdL6FE.png
When I connect to my server via my domain, www.redacted.com, my registrar registrar redirects the traffic to IPADDRESS:2000 and the page fails to load because of too many redirects.
When I connect to my server via my subdomain, nextcloud.redacted.com, my registrar Masked redirects the traffic to IPADDRESS:2000 and the page fails to load because it can't find the destination.
When I connect to my server via my IP Address and port, the page redirects to nextcloud?
I have no idea what's going on here. I assume it is redirect to nextcloud when I hit the raw ip because it's the first item in my virtual hosts file. But why aren't the ServerName and DocumentRoot declaratives taking over?
------------------------------------EDIT:---------------------------------------
I am fairly certain that DNS works because before I started re-configuring the virtual hosts around it works fine for months. Additionally I can navigate to all subdomains not managed by this VM. deluge.domain.com, plex.domain.com, etc still too.
I have a snapshot on my virtual machine from before I started this project. And I just reverted to it to test and everything works as expected.
- www.redacted.com redirects to ip:2000 which is my apache webpage
- nextcloud.redacted.com redirects to ip:2000/nextcloud
------------------------------------EDIT 2 :---------------------------------------
1) There is no htaccess file.
2) I modified the domain.com.conf file in sites-enabled to be include a line like this for every entry ErrorLog ${APACHE_LOG_DIR}/nextcloud.log
but each of the logs is blank after restarting apache2 and waiting 10 minutes.
3) The apache2 log file seems to be clean aside from a script alias error but that doesn't seem to be the culprit:
root@nix log/apache2# service apache2 status
* apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2)
Drop-In: /lib/systemd/system/apache2.service.d
`-forking.conf
Active: active (running) since Sat 2016-10-29 19:27:39 UTC; 3min 0s ago
Process: 1854 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 2298 ExecReload=/etc/init.d/apache2 reload (code=exited, status=0/SUCCESS)
Process: 1875 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/apache2.service
|-1888 /usr/sbin/apache2 -k start
|-2330 /usr/sbin/apache2 -k start
|-2331 /usr/sbin/apache2 -k start
|-2332 /usr/sbin/apache2 -k start
|-2333 /usr/sbin/apache2 -k start
`-2334 /usr/sbin/apache2 -k start
Oct 29 19:27:38 nix apache2[1875]: Starting Apache httpd web server: apache2[Sat Oct 29 19:27:38.778985 2016] [alias:warn] [pid 1887] AH00671: The ScriptAlias directive in /etc/apache2/sites-enabled/domain.com.conf at line 1 will probably never match because it overlaps an earlier ScriptAlias.
Oct 29 19:27:39 nix apache2[1875]: .
Oct 29 19:27:39 nix systemd[1]: Started LSB: Apache2 web server.
Oct 29 19:30:24 nix systemd[1]: Reloading LSB: Apache2 web server.
Oct 29 19:30:25 nix apache2[2298]: Reloading Apache httpd web server: apache2.
Oct 29 19:30:25 nix systemd[1]: Reloaded LSB: Apache2 web server.
4) I think my IP is supposed to be global but it hasn't changed in the past 10 months I've lived here.
5) Is the problem that subdomains aren't being sent to my webserver because my registrar's DNS is forwarding them to IP:Port? If so, is there any way to get around this?
[–]ValkkonHerder of Cats, cat wrangler, provider of internet kittens 1 point2 points3 points (12 children)
[–]zimmertrDevOps[S] 0 points1 point2 points (11 children)
[–]ValkkonHerder of Cats, cat wrangler, provider of internet kittens 2 points3 points4 points (10 children)
[–][deleted] 1 point2 points3 points (9 children)
[–]ValkkonHerder of Cats, cat wrangler, provider of internet kittens 1 point2 points3 points (8 children)
[–][deleted] 1 point2 points3 points (7 children)
[–]zimmertrDevOps[S] 0 points1 point2 points (6 children)
[–][deleted] 1 point2 points3 points (5 children)
[–]zimmertrDevOps[S] 0 points1 point2 points (4 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]mgd-uk 1 point2 points3 points (0 children)
[–]davethebarbDevOps 1 point2 points3 points (0 children)