How to run a web server off a usb flash drive
Actually, turns out to be really easy:
- Install Slax on the USB flash drive. Here’s how I did it.
- Download the Xampp module for Slax. I got version 1.6.2 from here.
- Copy the
Xampp_1_*_.mo
file that you downloaded to themodules
folder on your USB flash drive. - Boot off the USB flash drive.
- Open a terminal and type:
/opt/lampp/lampp start
- Open Konqueror and navigate to the URL
http://127.0.0.1
. You should see the Xampp info screen. - To see what your webroot directory is, look at
/opt/lampp/etc/httpd.conf
. Here, it is/opt/lampp/htdocs
. - I added a symlink in
opt/lampp/htdocs
to a directory calledslax_files
on the larger data partition on the usb drive (I had partitioned the drive and put Slax on the smaller partition). I can now access files in that folder athttp://127.0.0.1:slax_drives/
(This symlink does not survive a reboot. See the next post on how to make it permanent.)
November 28th, 2007 at 10:22
I can not navigate to the URL http://127.0.0.1 !:(
I get this:
Forbidden
You don’t have permission to access / on this server.
Apache/2.2.4 (Unix) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e PHP/5.2.2 mod_apreq2-20051231/2.5.7 mod_perl/2.0.2 Perl/v5.8.7 Server at 127.0.0.1 Port 80
What is problem?
November 28th, 2007 at 10:41
Hi Srky,
Check the permissions of the stuff in your webroot dir. Files should be readable by all, dirs r and x by all.
Also, make sure you have an index.html or index.php in your web root. On my slax, there’s an index.html in /opt/lampp/htdocs that includes a referrer to /xampp/, and in /opt/lampp/xampp, theres another index.php.
m.
November 28th, 2007 at 13:41
Thanx for your fast reply M, but I`m not so sure I understand this.
I think I have this index.html files at that places.
I`m relatively new in web servers but I`m trying:)
Where is webroot directory?
November 28th, 2007 at 13:58
Look at the file
httpd.conf
, see item no. 7 in the original post. Look for the line withDocumentRoot
. That is your web root directory (this is where apache looks for files to serve).Make sure you check the file permissions in that directory as I said in the previous comment.
I’m also new to web servers :)
November 28th, 2007 at 14:47
Here we are:
DocumentRoot “/opt/lampp/htdocs”
Permissions –
Owner: Can View & Modify Content
Group: Can View Content
Others: Can View Content
Only owner can rename and delete folder content – left empty.
Ownership –
User: nobody
Group: root
6. Open Konqueror and navigate to the URL http://127.0.0.1.
You should see the Xampp info screen.
http://127.0.0.1/
403 Forbidden
You don’t have permission to access / on this server.
What went wrong?:(
November 28th, 2007 at 15:17
That looks okay. The files in there should also be readable, in particular the index.html file.
You could also create a new minimal html file in /opt/lampp/htdocs, call it for example test.html:
Make sure that has “readable by everyone” permissions, then point Konqueror directly to
127.0.0.1/test.html
If that doesn’t work, another thing I can think of (but I’d say it’s unlikely) is that for some weird reason on your machine localhost isn’t 127.0.0.1. You could try
http://localhost
instead, or go to a terminal, typeifconfig
and look for an interface calledlo
, and try the IP address you see.If that’s not it, my next guess is that it’s some setting in your
httpd.conf
, though if you got the same xampp as I did, it would be odd that it would have restrictive settings. I don’t know more about httpd.conf, so you’d have to just read it and try out some changes. It contains pretty good comments.November 29th, 2007 at 09:49
If:
root@slax:~# /opt/lampp/lampp stop
Stopping XAMPP for Linux 1.6.2…
XAMPP: Stopping Apache with SSL…
XAMPP: XAMPP-MySQL is not running.
XAMPP: Stopping ProFTPD…
XAMPP stopped.
Browser says:
An error occurred while loading http://127.0.0.1/:
Could not connect to host 127.0.0.1.
If:
root@slax:~# /opt/lampp/lampp start
Starting XAMPP for Linux 1.6.2…
XAMPP: Starting Apache with SSL (and PHP5)…
XAMPP: Starting MySQL…
XAMPP: Starting ProFTPD…
XAMPP for Linux started.
Browser says:
Forbidden
You don’t have permission to access / on this server.
Apache/2.2.4 (Unix) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e PHP/5.2.2 mod_apreq2-20051231/2.5.7 mod_perl/2.0.2 Perl/v5.8.7 Server at 127.0.0.1 Port 80
Server is here, my localhost is 127.0.0.1 but it refuse to replay!
I found on the internet this Error 403 Forbidden and this is what it looks like:
(I hope it may be usefull if something goes wrong)
HTTP Error 403 – Forbidden
Introduction
Your Web server thinks that the HTTP data stream sent by the client (e.g. your Web browser or our CheckUpDown robot) was correct, but access to the resource identified by the URL is forbidden for some reason.
This indicates a fundamental access problem, which may be difficult to resolve because the HTTP protocol allows the Web server to give this response without providing any reason at all. So the 403 error is equivalent to a blanket ‘NO’ by your Web server – with no further discussion allowed.
November 29th, 2007 at 10:35
Well, yes, that’ s the problem, but the solution might still be quite simple.
(BTW, of course you get an error whey you stop lampp, because now apache isn’t running).
I just did a mini test on this machine with apache2 (not lampp, but I don’t think it should make a difference):
If I remove read permissions for others from index.html in my web root (chmod 600), I get:
You don't have permission to access /index.html on this server.
If I remove index.html altogether from the webroot (rename it to something else), I get:
You don't have permission to access / on this server.
That’s why I asked whether you have an index.html file in your web root. Now, for my lampp, the index.html is just a redirect to something like xampp/index.php, so to remove a layer of complexity, I asked you to create the test.html, make sure everyone can read it (chmod 644) and try to connect to localhost/test.html or 127.0.0.1/test.html. Did that work?
In any case, if it didn’t, that’s as far as I can help you, but if you find out what it was, I’d be curious to know. Goog luck!
November 29th, 2007 at 18:33
Ok. This is my first step, thanx for your patience. I will inform you about my discoveries:)
November 30th, 2007 at 13:11
HI, M
still don`t have permission:(
This is the content of my /opt/lampp/htdocs/index.html
Is your the same?
November 30th, 2007 at 13:37
Hi M.
This is the content of my /opt/lampp/htdocs/index.html
It includes a referrer to /xampp/ but there is no xampp folder!
I have no folder xamp in /opt/lampp/ either.
Only xampp that I have is in /opt/lampp/htdocs.
S.
November 30th, 2007 at 13:38
Hi M.
This is the content of my /opt/lampp/htdocs/index.html
It includes a referrer to /xampp/ but there is no xampp folder!
I have no folder xamp in /opt/lampp/ either.
Only xampp that I have is in /opt/lampp/htdocs.
S.
November 30th, 2007 at 13:40
Hi M.
This is the content of my /opt/lampp/htdocs/index.html
html
head
meta name=”author” content=”Kai Oswald Seidler”
meta http-equiv=”refresh” content=”0;url=/xampp/”
/head
body bgcolor=#ffffff
/body
/html
It includes a referrer to /xampp/ but there is no xampp folder!
I have no folder xamp in /opt/lampp/ either.
Only xampp that I have is in /opt/lampp/htdocs.
S.
November 30th, 2007 at 13:44
What is?
That should be fine, since htdocs is the web root (DocumentRoot) and the path is probably relative.
Did you try creating the
test.html
? Did you get an error message? What was it exactly?November 30th, 2007 at 13:54
Yes I tried to create test.html, but the aswer is the same:
Forbidden
You don’t have permission to access / on this server.
———————————————————————————————————————–
Apache/2.2.4 (Unix) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e PHP/5.2.2 mod_apreq2-20051231/2.5.7 mod_perl/2.0.2 Perl/v5.8.7 Server at 127.0.0.1 Port 80
I`m confused
November 30th, 2007 at 14:00
Your index.html looks fine. As I told you, it’s a redirect. Go to
/opt/lampp/htdocs/xampp
and check the permissions for that folder and the files in it. Must be readable by all, and the directory xampp itself must be executable by all (rwxr-xr-x). Do you have anindex.php
in there, is that readable by all. Really, I’ve already typed up all the steps I would check above, but I don’t get the impression you actually checked them. If it’s none of these things, again as I said before, I’d go and take a look athttpd.conf
.November 30th, 2007 at 14:03
That’s odd, because I would expect it to say “You don’t have permission to access test.html on this server.” Just to double check, did you put in
http://localhost/test.html
into the URL bar?November 30th, 2007 at 14:10
/opt/lampp/htdocs/xampp drwxr-xr-x root
/opt/lampp/htdocs/xampp/index.php -rwxr-xr-x root
is that ok?
November 30th, 2007 at 14:17
Sorry for confusing you about (17).
Forbidden
You don’t have permission to access /test.html on this server.
Apache/2.2.4 (Unix) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e PHP/5.2.2 mod_apreq2-20051231/2.5.7 mod_perl/2.0.2 Perl/v5.8.7 Server at localhost Port 80
November 30th, 2007 at 14:22
Okay. So if your permissions for
/opt/lampp/htdocs/test.html
are readable by all, then I can only imagine that you have some restrictive settings somewhere else. You really need help from someone who knows more than I do :)Go dig around httpd.conf, or do
ls -a
inside yourhtdocs
directory and see whether you have a restrictive.htaccess
file in there. Though that’s really unlikely with a fresh xampp install I’d guess.November 30th, 2007 at 14:22
That should be fine.
December 1st, 2007 at 17:22
Hi M.
I couldn`t make this thing work on SLAX Standard…
Slax Server means business :)
Happy coding
December 1st, 2007 at 17:41
Interesting. I don’t think I downloaded a Slax server edition, but I’m not sure. Glad to hear you’ve got it running.
December 1st, 2007 at 19:03
SLAX Server – hand watch
SLAX Standard – not original All Stars:)
June 12th, 2008 at 19:28
Hello Srky,
Sorry i’m not french,
i suggest you to verify if your entirely path to your web directory is accessible for all. I tell you that because generally your home directory is set to drwx—— by default and so even if your web directory is rwxrwxrwx you cannot access to it.
So you can go to the / directory in root, and enter the command :
#chmod -R 777 /home/user
I hope that helps you.
Bye
June 12th, 2008 at 19:30
in the previous message I make error I would say sorry i’m french and i don’t speak english ;)
April 9th, 2009 at 09:34
cd /opt/lammp
chmod -R 777 /htdocs