LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to start apache server (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-start-apache-server-216035/)

msubramanian 08-10-2004 10:46 PM

how to start apache server
 
I have installed Slackware 10 Linux and started Xwindows and KDE desktop. I don't know how to start Apache server and configure to use a DNS alias to function as a webserver. Will appreciate if you can help get started. Thanks


MS

ppuru 08-10-2004 10:57 PM

Slackware stores its startup scripts at /etc/rc.d. To make a script startup automatically at boot, just chmod them as executable (chmod +x <rc.filename>).

redhatgeek 08-10-2004 11:39 PM

http://sol4.net/linux/apache1.shtml

Starting Apache Server at Boot Time

Judging by the volume of emails hitting the inbox, this has got to be close to the top of the list of most common areas of confusion experienced by those just moved over to Linux from the Windoze world. In response to these emails, this page has been developed to cover all you need to solve the confusion caused by this issue, without using excessive technobabble which only makes things worse.



One thing to understand before continuing, is that this document has only been tested this under Slackware 8 and 9, Redhat Linux 6.2 and 7.1 with Apache installed in the default locations, as per the apache/php4 install HOWTO.


Location of startup files


Under Slackware Linux the startup scripts are located in /etc/rc.d/, plus the Apache startup procedure is the same regardless of if you boot to X or not. Whereas under Redhat Linux things are not as straightforward, the system startup scripts are located in the /etc/rc.d/init.d directory, which in turn is linked to from the specific runlevel startup scripts, which in turn are stored in /etc/rc.d/rcx.d directories (replace x with the runlevel you use). In my case I do not boot directly into X windows so I use runlevel 3, so my startup scripts are in /etc/rc.d/rc3.d and this is the directory that the Apache startup is to be linked to in this example.


Apache startup script


When built and installed from the source tarball, a script is installed in /usr/local/apache/bin called apachectl which is used to control the httpd daemon (apache itself). This script takes a number of command line parameters, with the ones you need to know about at this point being; start, stop and restart.


Starting Apache under Redhat


Under Redhat, to start Apache at boot time you, after logging in as root, you need to create the following link.

ln -s /usr/local/apache/bin/apachectl /etc/rc.d/init.d/apache



For Redhat 6.2

ln -s /etc/rc.d/init.d/apache /etc/rc.d/rc3.d/S37apache



For Redhat 7.1

ln -s /etc/rc.d/init.d/apache /etc/rc.d/rc3.d/S57apache



Looking at the above examples, you will notice the only difference is the name of the link. This difference makes sure that the Apache daemon starts after inetd or/and xinetd. Not really necessary in everyones opinion but something thats never caused any problems in the past, its up to you. Another thing that you will notice, and yes a number of users have emailed, about it, asking why the links are not direct from the runlevel script directory to the apachectl script, and yes you can do this, its just clearer not to, as you have one common of reference for future changes, this one is also really up to you.


The next time you boot you will see Apache added to the list startup, and hopefully a green OK.


Staring Apache under Slackware


As mentioned earlier, the startup scripts are very simple, there is no difference between the different run-levels as with Redhat. So regardless of how you boot, you start Apache automatically like this.


open /etc/rc.d/rc.local with your favorite text editor and add the following line to the bottom.

/usr/local/apache/bin/apachectl start



Thats it, next time you boot, you will get the following message just before you are prompted to login.

/usr/local/apache/bin/apachectl start: httpd started


All times are GMT -5. The time now is 10:23 AM.