Search code examples
ubuntueggdrop

Exposing a directory/location to the web


I have a VPS running Ubuntu and Apache

For example's sake, let's say the address is: 5.5.5.5

  • On the VPS I have a user named eggdrop (besides my root user).
  • user eggdrop has a home directory path like so: /home/eggdrop/
  • In that location I have a directory named logs, thus: /home/eggdrop/logs/
  • The directory named logs contains two other directories named: dir1 and dir2
  • Thus: /home/eggdrop/logs/dir1/ & /home/eggdrop/logs/dir2/

Those locations would contain various log files I'd like to make public for anyone who visits a specific link.

How then could I expose dir1 to the following address, when typed in a browser: 5.5.5.5/dir1/ so that when someone visits that link, it would render a list of those log files contained in /home/eggdrop/logs/dir1/?

Linux ubuntu18 4.15.0-22-generic #24-Ubuntu


Solution

  • you can use Alias:

    Alias /dir1 /home/eggdrop/logs/dir1/
    <Directory /home/eggdrop/logs/dir1/>
            Require all granted
    </Directory>
    

    This line you can put into /etc/apache2/sites-available/default.conf , inside VirtualHost block.

    Check your permission, if www-data user can read your logs directory.