Apache: In the beginning...


 
Thread Tools Search this Thread
Special Forums IP Networking Apache: In the beginning...
# 1  
Old 09-26-2003
Data Apache: In the beginning...

Smilie

Hello Everyone,

This is my first post on this forum, and I a already like it :-)

As you can tell I am a complete newbie to Apache. My mission is to setup a web server on my Suse Linux 8.1 box, initially for test purposes, and then if my ISP provider permits, then to allow other poeple to connect to it too....

Anyways, I have taken on board the advice of most forum administrators, in the sense that I looked at all of the post which are likelly to answer my question, in the hope not to bore you with trivial questions.
I have also digested numerous FAQs, and HOT-TOs, together with many google searches on Apache....

And the truth is that I still never get a straight answer to the most basic questions....
My question is: How do I use Apache ?

I have correctly installed it: OK
I have successfully started it as root (apachectl start)
I have also edited the /usr/local/apache/conf/httpd.conf file (after making a backup of course)
and I made some changes:

Listen myipaddress:80
BindAddress *
User wwwrun
Group users
DocumentRoot "/home/RSIA_taehakkyo/usr/rsia/rsias/www"
<Directory "/home/RSIA_taehakkyo/usr/rsia/rsias/www">
<IfModule mod_userdir.c>
UserDir public_html
UserDir www
</IfModule>
In all, I added all of the specifications that anyone else would in my position

Now I have copied one index.html and one cgi script to the ~user/www/ directory and ~user/www/cgi-bin directories respectively (N.B I also created these directories)
Now I try to restart the httpd, through apachectl restart, and it indicates that this went OK.

However, when I do this:
lynx
netscape
opera
...

or any other browser with :
http://myipaddress/index.html
http://myipaddress/icgi-bin/file.cgi
I get a default Suse Linux page, and nothing else.
Can someone, please tell me what I am doing wrong, and how I can overcome this issue.

I appreciate any help in this direction.

N.B last question: can I host my website (having bought a domain name) from home ?
what is the procedure ?
what are the pros & cons

Merci beaucoup mes amis !

Da Bionicfysh
# 2  
Old 09-26-2003
The index.html file goes into /usr/local/apache/htdocs directory. In general, if you are setting up user specific path you access it by going to http://yourdomain.com/~username/.

In order for you to set up a web server that can be accessed by people outside. You need a real ip address (ask your isp), domain name and dns server (check out granitecanyon.com if you don't want to set it up yourself or pay for it).

Hope this helps.
# 3  
Old 09-26-2003
i don't think you should modify the default DocumentRoot. It's intended to be for use by root in most installations.

Sounds like you use the SuSE rpms so it defaults to the SuSE-specific default page.

Sounds like your URL should be instead
http://localhost/~RSIA_taehakkyo/index.html

As for CGI scripts, you can't run one unless you explicitly enable using the ExecCGI option.

I suggest you to restore to your SuSE configuration and restart from there.
# 4  
Old 09-30-2003
Quote:
Originally posted by cbkihong
i don't think you should modify the default DocumentRoot. It's intended to be for use by root in most installations.

This is not true.

The DocumentRoot has nothing to do with the root user. In fact, most people do not run Apache as root, to do so would decrease security.

You can put your DocumentRoot anywhere you want to as long as your have permissions to do so and give the documents the appropriate ownership and permissions.
# 5  
Old 09-30-2003
Quote:
Originally posted by Neo
*snip*
The DocumentRoot has nothing to do with the root user. In fact, most people do not run Apache as root, to do so would decrease security.
I think what he meant was that only root had write access, which is normal. That way, if someone gains nobody (or apache, whatever user apache runs as, as it differs on distros) privledges, they still cannot "deface" the website. As this user is very new with *nix, they probably would not check for this. That being said, doing a:
ln -s /path/to/webserver/directory /www
would accomplish this, while still being ok from anyone who would gain nobody, or apache.
# 6  
Old 09-30-2003
Many people do not run their apache web server as 'nobody' and it really has nothing to do with the document root.

Many versions of software like MySQL more easily run as a user such as mysql and when the web server runs as the mysql user, things work a lot better.

There is no reason to associate the root directory of an apache a document tree with the root user or similar groups and permissions.

Root, in this instance, simply means document tree root. Apache can run as many users, normally should not be root, but not necessarily 'nobody' for many applications. The root of document trees in Apache can owned and written to by any user, according to the configuration of the system.
# 7  
Old 10-01-2003
Quote:
Originally posted by Neo
Many people do not run their apache web server as 'nobody' and it really has nothing to do with the document root.

Many versions of software like MySQL more easily run as a user such as mysql and when the web server runs as the mysql user, things work a lot better.

There is no reason to associate the root directory of an apache a document tree with the root user or similar groups and permissions.

Root, in this instance, simply means document tree root. Apache can run as many users, normally should not be root, but not necessarily 'nobody' for many applications. The root of document trees in Apache can owned and written to by any user, according to the configuration of the system.
nobody 12954 0.0 0.0 6184 0 ? SW Sep20 0:00 [httpd]

This is the default on Red Hat 7.3, and I am not where I can confirm this on other distros. Apache typically runs either as nobody, or apache. Apache should *NEVER* run as root as whenever possible. I have pushed out several servers, where Apache is either running as nobody, or apache, and MySql was installed and configured to work with Apache. IMHO, Apache should not run as another user. I have never had any problems with MySQL running as a user different than Apache, and in fact this is more secure. If someone takes over MySQL, you don't want them to be able to kill httpd, etc.

I beg to differ on the permissions of the document tree root, root should be the only person (static websites here) that has write access to the website, so if someone does break into Apache, they cannot deface the website:

drwxr-xr-x 5 root root 4096 Aug 4 23:40 htdocs

is the default when installing Apache from source. This is done for a reason.

Please don't take this the wrong way Neo, simply giving my two cents on the matter. I guess I'm a bit paranoid on security, but in my job you have to be Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Beginning learner

Hi guys, New member here, also new student! I'm just starting the Shell Programming, currently in chapter four in the Book in Unix, Linux, and OS X by Stephen G. Kochan & Patrick Wood (4th edition). I'm needing a little help with other possible ways to shorten this shell command: // ... (1 Reply)
Discussion started by: shiver
1 Replies

2. Red Hat

Process not running: /opt/java15/jdk/bin/java -classpath /opt/apache/apache-ant-1.7.0-mod/lib/ant-la

Have no idea on what the below error message is: Process not running: /opt/java15/jdk/bin/java -classpath /opt/apache/apache-ant-1.7.0-mod/lib/ant-launcher.jar org.apache.tools.ant.launch.Launcher -buildfile build.xml dist. Any help? (3 Replies)
Discussion started by: gull05
3 Replies

3. Web Development

Apache module development on apache 2.2

Hi, I'm new to developing modules for Apache. I understand the basics now and can develop something simple which allows a 'GET' request to happen, but what I want to do is actually 'POST' information to my site. I know the basic POST Request works and I can see that it is post by looking at... (2 Replies)
Discussion started by: fishman2001
2 Replies

4. Shell Programming and Scripting

How to append in the beginning not at the end?

Hi, I now that >> will append text to the end of the text that is already inside the file. How to append the new text infront of the text that is already in the file. Thanks for any input. Regards, Chandu (3 Replies)
Discussion started by: chandrakanth
3 Replies

5. Programming

Beginning svn

I had hard time to understand svn, and asked my admin who said I was over thinking and recommend remember the 5~6 commands to do as told. But I am so lost when the situation changed a little bit. For example, I am in my local box under my project folder: /home/yifangt/svn/ where there are two... (5 Replies)
Discussion started by: yifangt
5 Replies

6. Shell Programming and Scripting

beginning less from line #

Hi from a script i want to to read a file beginning at line e.g. number 21 to the EOF. less +n21 temp.txt Bevor the result, it brings an empty page, so that i cant use for scripting. Any idea how the problem can be solved? Thanks in advance! IMPe (2 Replies)
Discussion started by: IMPe
2 Replies

7. Programming

Beginning C++

I want to learn C++ ! :) I have basic programming knowledge with python and perl. Does anyone know of any great beginner tutorials for C++? (1 Reply)
Discussion started by: cbreiny
1 Replies

8. UNIX for Dummies Questions & Answers

Beginning with UNIX

I'd like to start learning UNIX. Where should I begin? I have a desktop PC running Windows XP, but I don't use it for much since I got my Macbook. I was going to install Windows on my Mac, but I quickly noticed that I have absolutely no need for it. I'm just starting to learn my terminal... (5 Replies)
Discussion started by: andou
5 Replies

9. UNIX for Dummies Questions & Answers

the very beginning

Actually, I had my first problem before even BEGINNING using my FreeBSD. The installation guide said I should run the rawrite tool and should do something like A> rawrite if i put the the file I want to image-copy and the rawrite.exe in the same directory somewhere. OK done that. Next it asks... (6 Replies)
Discussion started by: Mudrack
6 Replies

10. UNIX for Dummies Questions & Answers

beginning unix

i am fairly new to unix, and i would want a very simple, small command-line operating system to learn as much as possible. are there any good ones? i have a fairly old laptop w/ about 700 MB, running windows 95. i would like to partition it, anyone know how to do that? any help is very much... (1 Reply)
Discussion started by: henroid815
1 Replies
Login or Register to Ask a Question