光是Apache的安装就折腾了很久,因为一直不会源代码的安装方式,多次尝试直接安装rapache,但在使用中的锁死问题让我无从下手。最后还是用的源代码安装方式。下面记录一些简单的东西。、
安装过程的命令使用:
解压到指定的文件夹后:
./configure --prefix=/usr/local/apache2 --enable-so
之后是
make
make install
了解一些配置过程。主要的配置文件都在/etc/apache2
apache2.conf envvars mods-enabled sites-available
conf.d httpd.conf mods-available ports.conf sites-enabled
apache2.conf为主配置文件,httpd.conf为用户配置文件。在启动过程中有错误
Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
我是通过在httpd.conf中添加了
#ServerName
ServerName [IP address]
修正错误。
之后修改了/etc/apache2/sites-available/default 文件
把配置文件里的DocumentRoot 修改为你需要的新位置,比如: /home/username/httpdocs/
把<Directory /var/www/> 替换为<Directory /home/username/httpdocs/>
重启apache2
sudo /etc/init.d/apache2 restart
通过http://localhost/查看。
It works!