I have a Raspberry Pi with Apache 2.4 running on it. I have a site: www.mysite.nl which I want to host on the Pi.
I have created a virtual host with the following code:
<VirtualHost *:80>
ServerName mysite.nl
ServerAlias www.mysite.nl
DocumentRoot /var/www/mysite.nl/public_html
ErrorLog ${APACHE_LOG_DIR}/mysite.nl_error.log
CustomLog ${APACHE_LOG_DIR}/mysite.nl_access.log combined
</VirtualHost>
I have resolved the DNS to point at my router's public IP, and since my ISP provides static IP this shouldn't be an issue, and I have forwarded port 80 on the router to the static IP of the Raspberry Pi, 192.168.2.23. I have made sure that Apache listens on port 80.
I have enabled the site with a2ensite and disabled the default virtual host config file. But when I go to www.mysite.nl my browser will timeout and apache seems to fail to serve the site. If I check my access log I see nothing (0 lines of information), which tells me that the connection never arrived. Also nothing in the error log.
I have double-checked my DNS to point at the public IP of my router, but I have no clue where this goes wrong. I would like to receive information where it can wrong so that if I go to mysite.nl it will serve the index.html in /var/www/mysite.nl/public_html
Edit: Adding 192.168.2.23 mysite.nl to the host file works for PC inside network, but using an IP outside the network still wouldn't let me connect with mysite.nl. So Apache does serve web page, but not for external IP
Most routers will not like that.
The path would go from your internal pc, to your router, then back in to the pi.
Try adding www.mysite,nl with its internal ip address to your hosts file.