1

I have an apache2 webserver running perfectly on my Raspberry Pi (raspbian) and I recently wanted to make another site. To do this, I am trying to make use of name based virtual hosts. I've obtained another dynamic dns host name from https://my.noip.com/#!/dynamic-dns. I believe I have configured my 2 site conf files correctly and the hosts file.

My two websites are called ashwingupta.ddns.net and javacloudcompile.ddns.net (which is the one I had previously). However, if I connect to either one, I now get the site for ashwingupta.ddns.net. The following are the config files:

hosts

127.0.0.1   localhost
::1     localhost ip6-localhost ip6-loopback
ff02::1     ip6-allnodes
ff02::2     ip6-allrouters

127.0.1.1   raspberrypi
127.0.1.1       javacloudcompile.ddns.net
127.0.0.1       ashwingupta.ddns.net

javacloudcompile.ddns.net.conf

NameVirtualHost *:80
<VirtualHost *:8080>
    ServerName javacloudcompile.ddns.net
    ServerAdmin ashiwingupta@localhost
    DocumentRoot /var/www/html/vhosts/javacloudcompile.ddns.net/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

ashwingupta.ddns.net.conf

NameVirtualHost *:8080
<VirtualHost *:8080>
    ServerName ashwingupta.ddns.net
    ServerAdmin ashiwingupta@localhost
    DocumentRoot /var/www/html/vhosts/ashwingupta.ddns.net/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

I've enabled both sites w/ a2ensite and both claim to have been enabaled correctly. I then refreshed apache w/ service apache2 restart.

(Note, everything is intentionally on 8080, my ISP blocks inbound on 80)

edit: Forgot to mention, I do have Listen 8080 in my ports.conf

1 Answer 1

2

It appears to me that the NOIP service is calling your server via a frame, and the frame source is your server's IP address, rather than a domain name:

<frame src="http://68.101.98.197:8080" name="redir_frame" frameborder=0>

Your Apache server isn't receiving the server name with the request. Since the conf files are loaded in alphabetical order, ashwingupta.ddns.net.conf has the highest priority and is seen as the primary or default server (see https://httpd.apache.org/docs/2.2/vhosts/examples.html).

One way around this would be to use a different port for ashwingupta.ddns.net, e.g. port 8081, assuming you can specify that port number in the NOIP configuration.

2
  • ah thanks, I'll try this when I get a chance and let you know! Commented Dec 28, 2016 at 21:07
  • is there any other free domain service I might be able to use that you know of? Commented Dec 28, 2016 at 23:32

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.