Where is http://localhost ?????
This is a stupid question but here goes:
Im running mandrake 7.2. When I type http://localhost or http://ip_address in a browser I get the apache page. I want to replace this page with my own page but I dont know where this is stored on my machine Where is it located & in which directory ??????? Can someone please tell me amp2000 |
This is usually in the..
/usr/local/apache/htdocs But could be diffent on your box as far as the http://localhost & http://IP_ADDRESS giveing you the same page.. localhost is your box.. which is also 127.0.01, or better know as your loopback port. the http sends it to port 80 on both the localhost & IP_ADDRESS.. With Apache lisining to Port 80 it directs them to /usr/local/apache/htdocs/default.htm (or index.htm i cant remember) |
Cheer's
I spent ages trawling through directory's looking for it Thanks again amp2000 |
Sorry, I spoke to soon, I still cant find it.
I cd to /usr/local but apache isnt there. Any ideas where else it might be ? All I have in /usr/local is: bin doc games include info lib libexec man mysql mysql-test sbin share sql-bench src var As far as I know Apache is working cos when I view it in a browser it says "if you can see this page, Apache is set up properly". Any ideas?????? amp2000 |
Thats the Apache documentation, not the Document root!!!
Thats the Apache documentation, not the WWW Document root!!! You don't want to overwrite that!
The document root is /var/www/html Make it a habit to find such things from the man or info pages.. |
cd /
find var -name ´htdocs´ that should works... that's true, make it a habit to find it in the mans.. because the way is too long.. |
cd /
find usr -name ´htdocs´ forgot the usr :D |
ITs most likely in /usr instead of /usr/local
If you expect to find something in /usr/local/something and don't find it, remember to head to /usr/something |
Nice one, I got it.
/var/www/html is what I was looking for. The reason I didnt read the man pages is because I thought the installation was corrupt as there is no 'htdocs' anywhere on my system. I tried find the way you said infernal but it couldnt find it, & locate didnt find it either. Thanks again for helping everyone. P.S. Am I supposed to stick my public_html directory in /var/www/html, or is that a bad idea security wise ?? amp2000 |
You can dump your files in /var/www/html (and cgi files in /var/www/cgi-bin). but by default only root has write access to these dirs
So if possible, you should put your pages in your home directory's public_html folder (you have made a non-root user, haven't you?) There is some option in /etc/httpd/conf/httpd.conf to make users' accounts accessible as ~username... eg. http://localhost/~vinay this will look in /home/vinay/public_html I'm not sure which option. Read httpd.conf... its very well documented. |
Thanks
Cheer's vinaypai
Ye I did make a non root user & I also set up a public_html directory in it. I just didnt know where the option was so I could access it using http://localhost/~amp2000 I will soon though:) Guess I should read the documentation a bit more... amp2000 |
htdocs is for newer versions of apache. EXTREMELY newer. You've got to be right up to date. If you're running the default apache set up by pretty much any distro, including Mandrake 8.1, your webroot is, as was mentioned, /var/www/html, not apache/htdocs.
I tried creating a directory called /home/citizenbleys/public_html, but http://toshiharu/~citizenbleys/ doesn't work :( (toshiharu = hostname = alias for 127.0.0.1) |
Citizen Bleys: you wrote
.................................................................................................... ..... I tried creating a directory called /home/citizenbleys/public_html, but http://toshiharu/~citizenbleys/ doesn't work .................................................................................................... ..... Check out the 5th line in vinaypai's last post , You have to edit something in httpd.conf amp2000 |
The easiest way to find your web root directory is
1. $locate httpd.conf ( or find / -name 'httpd.conf' if locate doesn't find anything for you ). Your output of locate (or find) will have the full path to the httpd.conf file use this in place of /path/to/httpd.conf 2. $grep DocumentRoot /path/to/httpd.conf this will turn up DocumentRoot "/path/to/your/web/root/directory" To enable user home directories. Accessable by http://127.0.0.1/~username : 1. $vi /path/to/httpd.conf 2. do a search (use the '/' key) for UserDir this will turn up a spot with (use the 'n' key to advance to next search result occurence) about 12 lines commented out. Just remove the comment character. 3. #/etc/rc.d/init.d/httpd restart And your done ! note: some of these commands might need to be done as root instead of username |
All times are GMT -5. The time now is 01:42 PM. |