简体   繁体   中英

Missing var directory after Apache httpd installation

I installed apache httpd on my linux vm and wanted to start it's service. BUt I'm getting error (13)Permission denied. Error retrieving pid file run/httpd.pid (13)Permission denied. Error retrieving pid file run/httpd.pid I realised that I do not have this file. Not even a var directory. Any solutions for this? Pardon me, this is my first time touching servers.

I installed the apache like this:

gzip -d httpd-2.2.21.tar.gz

tar xvf httpd-2.2.21.tar

./configure --prefix=/home/Hend/Desktop/Server

make

make install

You have several alternatives for this:

Install apache in user directory, run as non-root user

This is the way you started doing that. But then you'll have to:

  • Add some customizations to the start script, or at least pass it enough environment variables to tell him where configuration / pidfile / etc. are
  • Modify the whole apache configuration, since the default uses directories to which you don't have access. For example, you should put your DocumentRoot somewhere else thant /var/www
  • Run the server on a non-standard port. Since unprivileged users cannot run services on ports lower than 1024, you must run apache on another port, such as 8000 instead of 80 . But this way, all your URLs will look like http://example.com:8000 instead of http://example.com .

Install apache from sources, into /usr/local

You can install apache in the default path for non-part-of-distro stuff, that is /usr/local instead of /usr/ . That is, use --prefix=/usr/local/ when running configure . This way, things should be much simpler. In any case, you'll have to run the webserver from root, and configure it to change user only after socket is opened.

Install apache from sources, into /usr/

You can also install apache in its default location, usint --prefix=/usr/ . This way things should be much simpler, it should install init scripts in the usual location /etc/init.d/apache2 or /etc/init.d/httpd , configuration in /etc/apache2 etc. Beware that doing this all the apache installed files will conflict with the ones of the version provided by your linux distribution!

Install apache from your distribution package manager

A part from the case in which you want particular setups (for example with non-standard patches), particular non-packaged versions (not recommended, since usually versions packaged with distros are guaranteed to be stable, others are not).

Benefits of doing this:

  • Avoid huge setup + configuration process to make it work
  • Versions from your distro should be "guaranteed" to be stable and tested with all the other programs shipped with it. Not always the latest version is better.
  • Each time a new release is updated (or more importantly, there is a security update), you can upgrade it semi-automatically by running a single upgrade command, without worrying about things going wrong during update.
  • This way the whole installation is just matter of a couple commands.

For example, on debian:

apt-get install apache2

On fedora:

yum install httpd

etc.

Then, if the service is not already started by package manager, you can start it with

/etc/init.d/apache2 start

or

/etc/init.d/httpd start

Job done. Now just put stuff in /var/www/ (or equivalent directory, depends on distro) and see it through you web server.

You have to start apache as root

Have you read the docs in the source distribution?

ie INSTALL

less INSTALL

  For complete installation documentation, see [ht]docs/manual/install.html or
  http://httpd.apache.org/docs/2.2/install.html

     $ ./configure --prefix=PREFIX
     $ make
     $ make install
     $ PREFIX/bin/apachectl start

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM