Forum Moderators: phranque

Message Too Old, No Replies

Issue accessing simple Apache web server setup

Everything checks out but still not able to access

         

Tydelane

6:24 pm on May 22, 2023 (gmt 0)



Please someone help. I am really new to this, but I have been working on this for days and I have restarted several times... I have set up Apache 2.4 on my Windows desktop to run a web server to host my website, and I am unable to access it correctly.

I can only access by doing the following:
- typing localhost on host device
- typing the private IPv4 address on the host device
- typing the private IPv4 address from another device connected to the network (wired or wirelessly)

I cannot access:
- by typing in the domain name, either on the network or off (ERR_CONNECTION_TIMED_OUT)

Configuration:
- I have an Arris SB6190 modem with a Netgear R6900v2
- Installed apache 2.4.57 as a service on Windows 11
- Changed nothing in httpd.conf except for changing Listen to "80", and changing servername to my domain name
- port forwarded port 80 to my host IP address
- turned off all Windows Firewalls
- set my domain name DNS record "A" to go to my public IP address
- Apache is listening on port 80 according to command line check
- called the ISP (optimum), they said they have no blocking mechanisms in place
- port checker says port 80 is closed
- DNS propogation websites say the DNS is fully propogated
- I have a dynamic public IP address (no business account), but the fully propogated IP in DNS records is currently still active for my network
- I ensured Apache is running as a service in Windows Services, and there are two Apache processes in task manager with the same PID as the address listening on port 80
- No syntax errors in httpd.conf according to command line check
- I can change the index.html file and it will change the appeance of the "site" using the origrinal htdocs directory
- I plugged the computer directly into the modem and there are no changeable settings like firewall or anything

If you can help I would appreciate it a lot and I can get more information if needed.

Here is some command line information I have so far:

Active Connections

Proto Local Address Foreign Address State PID
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 7172
[httpd.exe]

Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.17 25

Persistent Routes:
None


Server version: Apache/2.4.57 (Win64)
Apache Lounge VS17 Server built: May 9 2023 16:01:09
Server's Module Magic Number: 20120211:127
Server loaded: APR 1.7.4, APR-UTIL 1.6.3, PCRE 10.42 2022-12-11
Compiled using: APR 1.7.4, APR-UTIL 1.6.3, PCRE 10.42 2022-12-11
Architecture: 64-bit
Server MPM: WinNT
threaded: yes (fixed thread count)
forked: no
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses disabled)
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/apache"
-D SUEXEC_BIN="/apache/bin/suexec"
-D DEFAULT_PIDLOG="logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error.log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"




C:\Apache24\bin>httpd -M
Loaded Modules:
core_module (static)
win32_module (static)
mpm_winnt_module (static)
http_module (static)
so_module (static)
actions_module (shared)
alias_module (shared)
allowmethods_module (shared)
asis_module (shared)
auth_basic_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgi_module (shared)
dir_module (shared)
env_module (shared)
include_module (shared)
isapi_module (shared)
log_config_module (shared)
mime_module (shared)
negotiation_module (shared)
setenvif_module (shared)

not2easy

7:06 pm on May 22, 2023 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Hi Tydelane and welcome to WebmasterWorld [webmasterworld.com]

I am not the pro you need, but you might want to look into installing something like WAMP so Apache is in a proper server type framework. I know there are others that come through here with WIN experience that can be more helpful.

I set up a local MAMP server to try out remote WP setup years ago and don't think that it would have worked at all with only Apache installed.

phranque

6:05 am on May 23, 2023 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld, Tydelane!

could you please show the relevant <VirtualHost> envelope from your httpd.conf file?
(while using example.com as a placeholder for your domain name [webmasterworld.com] and also exemplifying your IP address)

phranque

6:42 am on May 23, 2023 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



what happens when you ping or traceroute the IP address or the hostname from an external network?

nickZ

1:08 pm on May 23, 2023 (gmt 0)



In order to use your homepc as a Webserver you need also to declare DNS, Nameservers.
Most internet providers offer only dynamic IPs, is your IP static or dynamic?


I have set up Apache 2.4 on my Windows desktop to run a web server to host my website, and I am unable to access it correctly.

not2easy

2:19 pm on May 23, 2023 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



True, DNS is usually set up with the domain registrar.

Tydelane

2:31 pm on May 23, 2023 (gmt 0)



phranque,

I appreciate your response to the topic. When I tracerte on a different pc connected to my phones hotspot, here are the results:

Tracing route to xxxxxxxxxx.com [xxx.xxx.xxx.xxx]
over a maximum of 30 hops:

1 92 ms 9 ms 75 ms xxx.xxx.xxx.xxx < I didn't recognize the IP address here
2 102 ms * 67 ms 107.xxx.x.xxx < Or this IP address here
3 * * * Request timed out.
4 * * * Request timed out.
5 * * * Request timed out.
6 * * * Request timed out.
7 * * * Request timed out.
8 * * * Request timed out.
9 * * * Request timed out.
10 * * * Request timed out.
11 * * * Request timed out.
12 * * * Request timed out.
13 * * * Request timed out.
14 * * * Request timed out.
15 * * * Request timed out.
16 * * * Request timed out.
17 * * * Request timed out.
18 * * * Request timed out.
19 * * * Request timed out.
20 * * * Request timed out.
21 * * * Request timed out.
22 * * * Request timed out.
23 * * * Request timed out.
24 * * * Request timed out.
25 * * * Request timed out.
26 * * * Request timed out.
27 * * * Request timed out.
28 * * * Request timed out.
29 * * * Request timed out.
30 * * * Request timed out.

Trace complete.

If I am understanding you correctly, here is the virtualhost envelope and I will just go ahead and include the vhosts.conf file too:

Virtual Envelope from httpd.conf:

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

vhosts.conf file:

# Virtual Hosts
#
# Required modules: mod_log_config

# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "${SRVROOT}/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "${SRVROOT}/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

Tydelane

2:41 pm on May 23, 2023 (gmt 0)



nickZ,

Thank you for your response! The domain I got is from google domains and I set up an A record with a TTL of one hour (just while I was trying to get things figured out) and set it to forward to my public (dynamic) IP address. While my ip address is dynamic, it has only changed once in the last week. The entire time I've been trying to get this to work this week my public IP address has matched the fully propogated DNS record that my nameserver is forwarding to (When the IP address changed I updated it on the google domain website and waited for propogation to continue testing again). I plan to do something about the dynamic IP in the future, hopefully there isn't some issue I'm not aware of there!

Tydelane

2:50 pm on May 23, 2023 (gmt 0)



not2easy,

Thank you,

I will absolutely look into WAMP. I don't have much PHP or SQL experience but I intend to learn. Also, I've read that the Apache server should at least display the default "It works" page when accessing the domain name I have set up without needing database management or PHP, do you know if this is true? All my attention has been focused at trying to get this page to display over the internet.

not2easy

3:52 pm on May 23, 2023 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Apache does not rely on sql or php but those are included with WAMP and MAMP to emulate a hosting environment because frequently websites may use resources that require the ability to process PHP. For example, WP would absolutely not function without database handling and current PHP installed on the server.

I have not heard of Apache displaying a page, it would need to exist on the domain you are trying to access. I do think the question of a static IP address is most important if you are trying to use your ISP's assigned IP for your DNS. I know that just any IP doesn't work, it needs to be set up as a Domain Name Server IP. You can visit https://www.dnsstuff.com/ for tools to check your DNS setup. Another DNS checker is at https://mxtoolbox.com/DNSCheck.aspx

Remember too that http:// (usually port 80) is not a secure protocol, many common browsers will not (or require your waiver to) work without the https:// protocol. If you cannot use a free "Lets Encrypt" certificate you would need to purchase one.

A good place to learn more about web development (free) is at https://developer.mozilla.org/

lucy24

6:01 pm on May 23, 2023 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Can you clarify, please: Are you trying to run a live, publicly accessible website from your home computer? Or are you just looking at a local version for testing (as described in a few replies to this thread)? What happens--that is, what do you want to have happen--when you turn off the computer, or your ISP goes down?

Tydelane

6:42 pm on May 23, 2023 (gmt 0)



lucy24,

Yes, I am trying to run a live publically accessible website from home and I assumed that if the site goes down it will not be accessible temporarily.

phranque

10:56 pm on May 23, 2023 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



what does ping do?
if i try to ping my public IP address i get no response.

it is quite likely that if you cannot ping your hostname or even your IP address, it isn't an apache problem.

phranque

11:03 pm on May 23, 2023 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



is you DNS configured for wildcard subdomains?

also important to note:
Remember too that http:// (usually port 80) is not a secure protocol, many common browsers will not (or require your waiver to) work without the https:// protocol.

if your browser is switching to https: protocol without you noticing, then you don't have a virtual host configured on the secure port (usually port 443):
<VirtualHost *:80>

phranque

11:24 pm on May 23, 2023 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I've read that the Apache server should at least display the default "It works" page when accessing the domain name I have set up without needing database management or PHP, do you know if this is true?

iirc the default apache install includes a default root directory index document that shows this message.
i believe that in your case, no connection is being made, regardless of port or protocol.

have you checked your ISP's ToS regarding hosting web sites or any other public-facing servers on your residential internet service?
it is quite likely port 80 (and 443) are blocked by your ISP.

even if not, it's going to be a PITA to keep up with DNS updates every time you lose a lease on your dynamic IP address.
there are solutions for this problem, but you would need a really short TTL which is bad for DNS performance.

you might be able to solve both problems by getting business account or at least a static IP address.
however that will also be a less optimal solution since upstream speeds are likely to be low and uptime might be an issue.

you are probably better off spending that money on a web hosting provider.

[edited by: phranque at 4:29 am (utc) on May 24, 2023]

Tydelane

2:06 am on May 24, 2023 (gmt 0)



phranque,

I was really hopeful there would be some way I could set up my website without having extra costs (even though web hosting services are relatively cheap) but Im sure you are 100% right that this will continue to be more hassle than its worth and for my needs I should just use a web hosting service. However, does that mean apache is really only ever useful to someone who pays high dollar for a business account? If the issue (which it seems like it is) is that I cant ping my public IP address because of ISP terms of service restrictions, then isnt it true there is no way I can ever use Apache for any purpose without upgrading my internet service? On a side note, I intended for my site to be a single webpage hosting a simple game Ive developed which is similar to cubefield. I really appreciate all the tips and advice.

lucy24

2:15 am on May 24, 2023 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just one page? Before anything else, check your ISP's fine print. I don't know if it's still the case, but some ISPs used to give you some minute amount of web space. You couldn't use your own domain name; it would have to be something like https://example.isp/members/yourname/ For a single page, if not too complicated, it might be enough.