Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
380 views
in Technique[技术] by (71.8m points)

ubuntu - 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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.8k users

...