Hi, I have a simple website and run linux on my computer. I'm going to start writing some simple PHP scripts for my website such as feedback/email forms etc. I want to run apache on my computer to test these programs before uploading them to my website. I have installed Apache using YAST. I have tried using commands like /etc/init.d/httpd start Code (markup): but nothing happens. How can I get Apache running? There doesn't seem to be much out there for beginners. Your help will be greatly appreciated. Thanks for your response.
The flavor of Linux you're using might help. Not all distributions are created equal. On my Ubuntu Linux (Debian derivitive) I use the following to start/restart/reload the server. /etc/init.d/apache2 start|restart|reload Code (markup):
Hi, Thanks for that. It worked! I thought I tried that, but your right- it works! Now when I type localhost into my browser it comes up with a 403 Error- Access forbidden! I think it's the default to just block access to everything. How can I overcome this error and get it to point to a single html page on my computer? I've tried messing around with the httpd.conf under the "directory" section but I can't work it out. What should I do next? I really appreciate your help
error 403 is not enough permission. check the file permission. Good luck to you , guy. I have been runnig and learning the linux now. All of the command make me mad. I have to run the linux on the vmware.
I just realized how vague my last reply was. When I say check the UNIX file permissions, what I mean that that you need to make sure the files, and the directory the files reside in, grant Read permissions to the user or group Apache is running as. If you run the following command in the terminal top -b -n 1 | cat Code (markup): you'll get a block of info about 5 lines long, followed by something similar to this where you can determine the name. That is, if you don't remember the user you put into the apache configuration. (or didn't) PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 15666 joebert 20 0 34292 2492 844 S 0.0 1.0 0:00.00 apache2 Code (markup): In some situations, for instance for FTP directory listings to work, and mod_autoindex to work, the user also needs to have Execute permission for the directory.
Hi Guys, I really appreciate your help and comments, I've checked the file permissions of Apache and my sites directory and they all have write and execute permissions such as: drwxr-xr-x 10 root root 4096 2008-09-28 13:56 apache2 Code (markup): This includes the files in the directory. But when I do that top command it shows: 7491 root 15 0 91608 3188 1676 S 0 0.3 0:00.10 httpd2-worker 7492 wwwrun 25 0 91340 1996 484 S 0 0.2 0:00.00 httpd2-worker 7493 wwwrun 25 0 307m 2680 936 S 0 0.3 0:00.00 httpd2-worker 7495 wwwrun 25 0 307m 2684 940 S 0 0.3 0:00.00 httpd2-worker 7498 wwwrun 25 0 307m 3344 1432 S 0 0.3 0:00.00 httpd2-worker Code (markup): So, I am thinking that maybe there is something wrong with the httpd.conf file. I have just made the following ammendments but it still doesn't work: # forbid access to the entire filesystem by default <Directory /home/james/AMW> Options None AllowOverride None Order allow,deny Allow from all </Directory> Code (markup): Thanks for your help. I am sure I will get there soon
Hi I am closer to solving this problem. The apache error logs (I never thought of looking there) now show- [Tue Sep 30 20:08:06 2008] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /srv/www/htdocs/ [Tue Sep 30 20:08:08 2008] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /srv/www/htdocs/ Code (markup): Do you know what this means?? All permissions in directories are read and executable, and the only .html doc is the index.html. Is there anything wrong with this configuration? # forbid access to the entire filesystem by default <Directory /home/james/AMW> Options None AllowOverride None Order allow,deny Allow from all </Directory> # use .htaccess files for overriding, AccessFileName .htaccess # and never show them <Files ~ "^\.ht"> Order allow,deny Allow from all </Files> # List of resources to look for when the client requests a directory DirectoryIndex index.html index.html.var feedback.html Code (markup): Please let me know your ideas as to what the problem is, thanks.
If you are not sure about the apache installation path, you can try runnning this command instead service httpd restart
There is probably another <Directory> directive somewhere in the file that has a Deny command. The other error message says: Directory index forbidden by Options directive: Code (markup): which means that there is no index.html in that directory and you have specified "Options None". If you want indexes, you need "Options Indexes". If not, try putting an index.html file in that directory. Lastly, some day I'm sure you'll be ready to run PHP files. When that happens you will want to add index.php to this line: DirectoryIndex index.php index.html index.html.var feedback.html Code (markup): or do something else like telling apache that PHP files end in .html or using mod_rewrite to rewrite any URLs that end in .html to PHP files.
Try putting this on your Directory Option -------------- Options Indexes -------------- Then restart or stop start apache.