0

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

t1f
  • 3,021
  • 3
  • 31
  • 61

1 Answers1

3

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.

lbor
  • 91
  • 4
  • Check /var/log/apache2/access.log and error.log . – lbor Jan 05 '21 at 17:51
  • other_vhosts_access.log says: `"GET /dir1/ HTTP/1.1" 404 495 "-" "Mozilla/5.0` and so on..that's all. Nothing related in access.log or error.log – t1f Jan 05 '21 at 18:01
  • Might this be the problem? `By default, Ubuntu does not allow access through the web browser to any file apart of those located in /var/www, public_html directories (when enabled) and /usr/share (for web applications). If your site is using a web document root located elsewhere (such as in /srv) you may need to whitelist your document root directory in /etc/apache2/apache2.conf. The default Ubuntu document root is /var/www/html. You can make your own virtual hosts under /var/www. This is different to previous releases which provides better security out of the box.` – t1f Jan 05 '21 at 18:05
  • Managed to get it working using your suggestion - thanks. – t1f Jan 05 '21 at 18:49