Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 782365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:22:32+00:00 2026-05-14T20:22:32+00:00

Let say I have a directory which is being hosted by Jetty or Apache

  • 0

Let say I have a directory which is being hosted by Jetty or Apache (i’d like an answer for both), i know the URL including the port and i can log into the server.

How can i find the directory that is being hosted by a certain port?

I’d also like to go the other way, i have a folder on the server, which i know if being hosted, but i don’t know the port so i can’t find it in a web browser.

How can i find a list of directories that are being hosted?

This has been bugging me for ages but i’ve never bothered to ask before!

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T20:22:33+00:00Added an answer on May 14, 2026 at 8:22 pm

    This is the way how to find it out for Apache. Lets say you have an URL http://myserver.de:8081/somepath/index.html

    Step 1: Find the process that has the given port open

    You can do this by using lsof in a shell of the server, which lists open files (and ports) as well as the processes associated to it:

    myserver:~ # lsof -i -P | grep LISTEN | grep :80
    apache2   17479        root    4u  IPv6 6271473       TCP *:80 (LISTEN)
    

    We now know there is a process called “apache2” with process ID 17479

    Step 2: Find out more about the process

    We can now look at the environment of the process, where more information should be available:

    myserver:~ # (cat /proc/17479/environ; echo) | tr "\000" "\n"
    PATH=/usr/local/bin:/usr/bin:/bin
    PWD=/
    LANG=C
    SHLVL=1
    _=/usr/sbin/apache2
    

    Okey, the process executable is /usr/sbin/apache2. Now lets look at the command line.

    myserver:~ # (cat /proc/17479/cmdline; echo) | tr "\000" " "
    /usr/sbin/apache2 -k start
    

    Step 3: Finding the config of the process

    Our previous examination has shown that no special configuration file has been given at the command line with the -f option, so we have to find the default location for that process. This depends on how the default command line is compiled into the apache2 executable. This could be extracted from it somehow, but obviously its the default location for Apache 2 on my machine (Debian Etch), namely /etc/apache2/apache2.conf.

    Step 4: Examining the Apache config file

    This again needs some knowledge about apache configurations. The config file can include other files, so we need to find those first:

    myserver:~# cat /etc/apache2/apache2.conf | grep -i ^Include
    Include /etc/apache2/mods-enabled/*.load
    Include /etc/apache2/mods-enabled/*.conf
    Include /etc/apache2/httpd.conf
    Include /etc/apache2/ports.conf
    Include /etc/apache2/conf.d/
    Include /etc/apache2/sites-enabled/
    

    A nice list. These configs tell evetything about your configuration, and there are many options that might map files to URLs. In particular apache can serve different directories for different domains, if those domains are all mapped to the same IP. So lets say on your server you host a whole bunch of domains, then “myserver.de” is either mapped by the default configuration or by a configuration that serves this domain specifically.

    The most important directives are DocumentRoot, Alias and Redirect. On my system the following gives a quick overview (comments omitted):

    myserver:~# ( cat /etc/apache2/apache2.conf; cat /etc/apache2/sites-enabled/* ) | grep 'DocumentRoot\|Alias\|Redirect'
        Alias /icons/ "/usr/share/apache2/icons/"
            DocumentRoot /var/www/
                    RedirectMatch ^/$ /apache2-default/
            ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        Alias /doc/ "/usr/share/doc/"
            DocumentRoot /var/www/
                    RedirectMatch ^/$ /apache2-default/
            ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        Alias /doc/ "/usr/share/doc/"
    

    Since the “mypath” part of the URL has no direct match, I can savely assume it lies below the DocumentRoot /var/www/, so the result of my search is that

    http://myserver.de:8081/somepath/index.html --> /var/www/mypath/index.html
    

    You can do a lookup in a similar way for jetty.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.