Cannot access Apache web server from Wan side
I am running apache 2.4.46 on parrot linux, I modified the default /var/www/html/index.html using html for educational purpose. I can access this server on LAN but I want to access this apache server on WAN, following some tutorials I port forwarded to inet 192.168.0.104 and port 80, I also used no-ip website to get a free dns and succesfully added it to my router. When I try to connect to this dns I get a 404 error. Can somebody help me to understand what I am missing.
ps ~ I after that removed the apache service and added ssh service on port 22 to check whether it was a dns mistake but I was successfully able to ssh into my computer over WAN
31 Answer
If you are receiving a 404 then you know your Apache server is visible to the outside world. A 404 means the server received the request but can’t find a file. If the server were not accessible, you would see a timeout.
The most common cause of this issue is an incomplete Apache configuration. Check that you have a ServerAlias line in your /etc/apache2/sites-enabled/000-default.conf file (or whichever site config file is your target). The line can contain multiple routing targets for the Apache installation. For example:
ServerAlias example.com *.example.comGenerally what I do with these is have a catch all *.* thrown on the end so that any unexpected request routes, such as an IP address or bare CNAME address, gets handled without returning a 404 or 500 error.