3

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?

3

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 & 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.

  • This returns a process name psahttp. Not sure what to make of that. Any more tips on how to find out how to stop/start this server and where the root file is? – teaman Dec 30 '14 at 7:27
  • @teaman open Activity Monitor, have it display all processes, search for psahttp and look at the files opened by that process. Or just invoke the mighty Google -> support.photosmithapp.com/knowledgebase/articles/… – nohillside Dec 30 '14 at 9:54
  • A Google search tells us that psahttp is a "small utility used by the Photosmith Lightroom plugin", and should quit automatically when you quit Lightroom. I have no idea why it would be listening on port 8080. – ganbustein Dec 30 '14 at 9:58
  • 1
    Thanks so much! It was Photosmith LR plugin and it was set to listen on port 8080 by default. It allows changing it in the preferences. So I changed to 8081 and now 8080 is not responding! It uses it to sync photos and settings between the Photosmith 2 iPad app and Lightroom app on the Mac. I didn't realize it used that port. – teaman Dec 30 '14 at 20:40
  • Such a geeky answer!! – technophyle Nov 30 '15 at 10:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .