Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have set up an Amazon EC2 instance with Apache, PHP, and MySQL (LAMP) using this tutorial.

All of that is working correctly, including phpMyAdmin, and you should be able to see the success page at:

http://54.235.216.209/

Now, I'm lost on how to upload public files, and change the default index page. I've successfully connected with Filezilla and created a /var/www/html directory in which I placed all my files. These also show up when I SSH in. However, when I navigate to

http://54.235.216.209/var/www/html 

or any variation, it says these directories do not exist. What am I doing wrong?

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

The directory /var/www/ is usually the root of the Web server, so you should not include it in the URL. Try accessing the files under:

http://54.235.216.209/html/

If the above does not work, try with (in case the Web root is mapped to /var/www/html):

http://54.235.216.209/
share|improve this answer
    
It looks like the folder I'm accessing via SFTP is home/ubuntu/. I just moved the html folder into /ubuntu/, but still no luck. I also cannot access the home folder. Any ideas? –  Jakemmarsh Jan 6 '13 at 19:55
    
What is the value of DocumentRoot in the Apache config ? The site config is usually under /etc/apache2/sites-enabled in Ubuntu. –  David Levesque Jan 6 '13 at 20:17
    
According to sites-enabled, the DocumentRoot is /var/www. But if I navigate to (my address)/var, it says that doesn't exist. –  Jakemmarsh Jan 6 '13 at 20:27
    
Again, DO NOT include neither var or www in your URL. Files you place under /var/www/ should be accessible directly from http://yourAdress/. If they are not, something is probably wrong with your installation. Did you install Apache using apt-get ? –  David Levesque Jan 6 '13 at 20:40
    
They are not accessible there. I do believe I installed Apache using apt-get, as stated in my original question I used that tutorial. Would it be a better idea to restart the process, and possibly not follow that tutorial? –  Jakemmarsh Jan 6 '13 at 22:42
show 1 more comment

File paths served by Apache don't start at the root directory, they start at whatever the Apache DocumentRoot is set to. For example, if DocumentRoot was set to /var/www then the path to your files would start with /html.

http://198.51.100.209/html/

/var/www/html is the physical directory on the server and Apache is pointing to this directory as Apache's root. This mapping makes /var/www/html effectively / from a URL perspective. So http://54.235.216.209/ will give you all the files under /var/www/html.

share|improve this answer
    
You are correct, the DocumentRoot is /var/www. However, if I navigate to (my IP)/html/, it says that directory does not exist. –  Jakemmarsh Jan 6 '13 at 20:33
    
Are the permissions on html/ such that the user Apache is running as can access this directory? Also I'd be checking Apache's error_log (/var/log/httpd/error_log) for guidance. –  slm Jan 6 '13 at 21:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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