2

JUST FOUND THIS; FOR PPL WITH APACHE PROBLEMS MAYBE. ALSO THIS SOLUTION SEEMS TO BE FOR THE PATIENT ONES xD

http://sites.duke.edu/workblog/files/2014/12/www.dedoimedo.com-apache-web-server-lm.pdf

I have been working on this for 3 days now. Finally able to acces http://[my.domain].com/ (installed mySQL and PHPmyAdmin, but I just read that those are not really needed? Cant work with them (yet) anyway so!)

when entering [mydomain]/com/ in a browser, without my /website.html, I get Index of/.
With indeed my website listed.

Is there a nice and simple way to make HTML links inside website.html point to certain files and/or folders in my /home/..../Downloads/?

Or otherwise include a link onto the "Index of /" that appears in my browser? So i guess my question is, how should I make a 2nd Directory root?

When I have not been clear enough Im sorry! Just tell me what you need to know! Also thank you all very much for your time and effort! Really appreaciate it!

1

Symlink way

If you want you can simply make an symlink to it, like i did on my Raspberry Pi, but I'm not sure if it's safe when your website is public. It works in home network.

Let's say you want to access /home/j (because "j" is my username) from your /var/www. To do that you'll need command ln -s /home/j jhome. Make sure you are in /var/www while running this command.

Now you should be able to access it simply using cd jhome. You can test it by putting html file inside /home/j and linking to it by for example your index.html.

You can do same thing with other directories and names.

More professional, Apache configuration way

Also, I've found some Apache documentation here and Stack Overflow topic, I think it's more professional way to do same thing and I believe it's right way to do it.

It turns out that you need to add Alias /alias_directory /path_on_your_machine line to your Apache config file (which for me is /etc/apache2/apache2.conf). (it also works for me) I recommend backuping file before editing it.


Here are exact commands I used:

  • cp /etc/apache2/apache2.conf{,.bak} - make backup
  • echo "Alias /jhome /home/j" >> /etc/apache2/apache2.conf - append line, you can also do that with nano or other text editor.
  • service apache2 restart - restart Apache, it won't work without it

Remember to run commands as root, because You'll get permission errors without it.

I hope I helped you in some way. :)

4
  • 1
    Ty very much also! at first Alias confused me, but getting closer and closer. But as far as I understand, Apache2 is fully capable on hosting a website + directory all by itself? With the complete LAMP stack? Cause php and mySQL don't really help, with my current knowledge it just makes it more incomprehensible! @kisanme – DrugCrazedRebel Apr 21 '15 at 22:33
  • 1
    @DrugCrazedRebel I have to admit that I'm not any Apache or web expert, but I use it, and it works for me very good. I don't use databases, but I can tell you that php works for me and I can use RPi GPIO without any configuration. – Jacajack Apr 21 '15 at 22:40
  • maybe you can try this... dcr.asuscomm.com/new.html xD Just to confirm my failure, OR succes on the website matter – DrugCrazedRebel Apr 21 '15 at 22:44
  • @DrugCrazedRebel In link you sen there's big "451 -" text. I'm not sure if it's some kind of error or something. I can try to help you tomorrow, because it's almost 1:00 am here and I'd like to go to sleep. ;) – Jacajack Apr 21 '15 at 22:52
1

If you have phpMyAdmin up and running, you probably have installed apache2. The process of mapping an http address to a directory in your localmachine is called a virtual host. Read more on this here. Or google for how to create a virtual host and a domain for my local machine.

I can guide you if you need more assistance on this matter.

6
  • ill edit my main post for clearity – DrugCrazedRebel Apr 19 '15 at 17:43
  • @DrugCrazedRebel Did any of described methods help you? – Jacajack Apr 20 '15 at 11:58
  • @DrugCrazedRebel I can explain you how to create a virtual host and add a local domain name for it if you want? And if that is exactly what you want from this question. – kisanme Apr 20 '15 at 16:31
  • ty very much! I thinks im getting close from Jacajack's link--> Just dont get this..... – DrugCrazedRebel Apr 21 '15 at 22:25
  • "UserDir directive used Translated path UserDir public_html ~bob/public_html/one/two.html UserDir /usr/web /usr/web/bob/one/two.html UserDir /home/*/www /home/bob/www/one/two.html The following directives will send redirects to the client: UserDir directive used Translated path UserDir example.com/users example.com/users/bob/one/two.html UserDir example.com*/usr example.com/bob/usr/one/two.html UserDir example.com/~*/ example.com/~bob/one/two.html" – DrugCrazedRebel Apr 21 '15 at 22:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.