[英]Missing var directory after Apache httpd installation
I installed apache httpd on my linux vm and wanted to start it's service. 我在我的linux vm上安装了apache httpd,并希望启动它的服务。 BUt I'm getting error
(13)Permission denied. Error retrieving pid file run/httpd.pid
BUt我收到错误
(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. (13)Permission denied. Error retrieving pid file run/httpd.pid
我意识到我没有这个文件。 Not even a var directory. 甚至不是var目录。 Any solutions for this?
对此有何解决方案? Pardon me, this is my first time touching servers.
请原谅,这是我第一次接触服务器。
I installed the apache like this: 我像这样安装了apache:
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: 你有几种选择:
This is the way you started doing that. 这是你开始这样做的方式。 But then you'll have to:
但是你必须:
DocumentRoot
somewhere else thant /var/www
DocumentRoot
放在/var/www
8000
instead of 80
. 8000
而不是80
。 But this way, all your URLs will look like http://example.com:8000
instead of http://example.com
. http://example.com:8000
而不是http://example.com
。 /usr/local
/usr/local
You can install apache in the default path for non-part-of-distro stuff, that is /usr/local
instead of /usr/
. 您可以在非分区发布内容的默认路径中安装apache,即
/usr/local
而不是/usr/
。 That is, use --prefix=/usr/local/
when running configure
. 也就是说,在运行
configure
时使用--prefix=/usr/local/
。 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.
在任何情况下,您都必须从root运行Web服务器,并将其配置为仅在打开套接字后更改用户。
/usr/
/usr/
You can also install apache in its default location, usint --prefix=/usr/
. 您还可以在其默认位置usint
--prefix=/usr/
安装apache。 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! 这样事情应该简单得多,它应该在通常的位置
/etc/init.d/apache2
或/etc/init.d/httpd
/etc/apache2
配置/etc/apache2
安装init脚本。请注意这样做所有的apache安装的文件将与您的Linux发行版提供的版本冲突!
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: 这样做的好处:
For example, on debian: 例如,在debian上:
apt-get install apache2
On fedora: 关于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. 现在只需将内容放入
/var/www/
(或等效目录,取决于发行版)并通过您的Web服务器查看。
You have to start apache as root 你必须以root身份启动apache
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.