环境: Ubuntu 14.04 + Apache 2.4.7
Apache2配置文件路径:/etc/apache2/apache2.conf
在文件中有如下几行include:
Include ports.conf# Include generic snippets of statementsIncludeOptional conf-enabled/*.conf# Include the virtual host configurations:IncludeOptional sites-enabled/*.conf
因此,可以将如下配置全部加入apche2.conf,也可以分别加入ports.conf和sites-enabled/000-defualt.conf。
下面以添加8000端口为例添加:
ports.conf
Listen 8000
000-default.conf
ServerAdmin webmaster@localhost DocumentRoot /var/www/php01/ Options Indexes FollowSymLinks AllowOverride None Require all granted
其中webmaster可以替换成你的用户名
最后,保存后sudo /etc/init.d/apache2 restart
重启apache时可能会提示AH00558: apache2: Could not reliably determine the server's fully qualified domain name
在apache配置文件中加入ServerName localhost即可,也可以不处理。