Question

I am trying to access an Apache server on my local machine, but can't get it to work. I had it working last week, but then it randomly stopped working. I have edited the httpd.conf file to update the port to 9876. I also added the ExecCGI directive in the HTDocs directory.

I usually see the index.html page I created by visiting localhost:9876, but now I just see an erroneous page. When I just run localhost:80, I see the it works page! How is something still showing up on port 80 when I clearly changed it to another port? I read more about this and found out it has to do with the sharing settings on OSX. These settings were never enabled to begin with. Why am I still seeing a page on port 80, and why is the designated port I chose not showing any content?

Things I have done:

  1. I have tried stopping and restarting the server multiple times(with sudo)
  2. I use the web browser or netcat to connect to apache, but I get no response.

I ran lsof -i4TCP:9876 and get the following output:

launchd      1           root   25u  IPv6 0xee69429dde6f1b6f      0t0    TCP localhost:ipp (LISTEN)
launchd      1           root   26u  IPv4 0xee69429dde6f2b77      0t0    TCP localhost:ipp (LISTEN)
LogMeIn     82           root    5u  IPv4 0xee69429dde6f238f      0t0    TCP *:globe (LISTEN)
vpnagentd   83           root    6u  IPv4 0xee69429de115bb77      0t0    TCP localhost:29754 (LISTEN)
GitHub     201  kamranpirwani    6u  IPv4 0xee69429de35f4b77      0t0    TCP localhost:25035 (LISTEN)
GitHub     201  kamranpirwani    7u  IPv6 0xee69429dde6f0eaf      0t0    TCP localhost:25035 (LISTEN)
mysqld     412         _mysql   14u  IPv6 0xee69429dde6efdaf      0t0    TCP *:mysql (LISTEN)
Coda\x202  726  kamranpirwani    5u  IPv4 0xee69429deb25fb77      0t0    TCP *:6942 (LISTEN)
Coda\x202  726  kamranpirwani    7u  IPv6 0xee69429dde6f12ef      0t0    TCP *:6942 (LISTEN)
Coda\x202  726  kamranpirwani   10u  IPv4 0xee69429deb47438f      0t0    TCP *:50490 (LISTEN)
Coda\x202  726  kamranpirwani   11u  IPv6 0xee69429dde6f062f      0t0    TCP *:50490 (LISTEN)
Coda\x202  726  kamranpirwani   12u  IPv4 0xee69429dea898b77      0t0    TCP *:50491 (LISTEN)
Coda\x202  726  kamranpirwani   13u  IPv6 0xee69429dde6ef96f      0t0    TCP *:50491 (LISTEN)
httpd     1879           root    5u  IPv6 0xee69429dde6f172f      0t0    TCP *:http (LISTEN)
httpd     1880           _www    5u  IPv6 0xee69429dde6f172f      0t0    TCP *:http (LISTEN)
httpd     1920           _www    5u  IPv6 0xee69429dde6f172f      0t0    TCP *:http (LISTEN)

This leads me to believe the my apache web server is listening for requests on this port. Why can't the browser or netcat connect to it?

Edit:

Log file(with personal email removed) http://pastebin.com/84RcB2Er

Was it helpful?

Solution

First you say (emphasis mine):

I am trying to access an Apache server on my local machine, but can't get it to work.

But then you say (again, emphasis mine):

When I just run on localhost, I see the it works page!

So unclear what the problem is.When you say you edited the .conf which one? Apache by default can handle virtual hosts so it’s possible you are running two virtual hosts on your machine with different document roots: One responding on port 80 & the other on port 9876. Can you exact details of the contents of the file you changed?

EDIT: The original poster indicates they are editing the httpd.conf in this location:

~/apache/conf/httpd.conf

When the systemwide Apache config is in this location:

/etc/apache2/httpd.conf
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top