How to determine where the localhost:8080 source and server are located I am running Mavericks OS currently on my iMac. It has been a while since I set up a web server on my iMac. I went to my Firefox browser and went to localhost:8080 and it returns a simple string "SUCCESS". How can I determine what server is responsible for this and where the source file is located? I have searched multiple locations and can't find it's location. I have looked at /etc/apache2/sites/...conf file and it shows /Users/(me)/Sites but the index.html located there is not what I'm seeing. I would expect that to be on port 80 anyway and it won't load, suggesting that the apache server were running, which I'm pretty sure is not, based on  the Activity Monitor.

I don't recall how the server was started. I have been dabbling with nodejs but not sure which project is involved with this. Is there a way to track this down and control the server and the webroot code located there?
Try:

sudo  lsof -n -i :8080 -s TCP:LISTEN


The first two columns will be the name and PID of the process(es) listening on port 8080.

Use the PID to find it in Activity Monitor, Get Info, and notice which files it has open. It'll have a bunch of libraries open, but high on the list will be the executable file.

Alternatively, from the name, see what service it corresponds to with

sudo launchctl list | grep theprocessname


For example, if the name were httpd, the above command would tell you the service name is org.apache.httpd. If you don't get any hits (because it's not running as a daemon), try it without sudo.

Ask launchctl for more info about that service. Continuing to use Apache as the example:

sudo launchctl list org.apache.httpd


would tell you

{
    "LimitLoadToSessionType" = "System";
    "Label" = "org.apache.httpd";
    "TimeOut" = 30;
    "OnDemand" = false;
    "LastExitStatus" = 0;
    "PID" = 39660;
    "Program" = "/usr/sbin/httpd";
    "ProgramArguments" = (
        "/usr/sbin/httpd";
        "-D";
        "FOREGROUND";
    );
};


Notice the "Program" line, which gives you the path to the executable. Most of that information comes from /System/Library/LaunchAgents/org.apache.httpd.plist, which is the file that tells Launch Services when to run the program and how.

Your web server, listening on port 8080, is not from Apple, so it won't be in /System/Library. Look in /Library/LaunchDaemons, or maybe even in ~/Library/LaunchAgents (if it runs only when you're logged in). (Listening on port 8080 does not require root privilege, so it could conceivably be running as you, although that has interesting security implications.)

Another place to look is in System Preferences→Users &amp; Groups→Login Items. Since we don't know how you set it up to run automatically, it might be that you didn't do it by putting a file in any of the ...Library/Launch* directories.