(1)修改 /etc/apache2/ports.conf 将php
NameVirtualHost *:80 Listen 80 # 改成本身须要的端口 NameVirtualHost *:9000 Listen 9000
(2)有的须要修改default和httpd.conf配置文件html
#查找配置文件 sudo find / -name default sudo find / -name httpd.conf
(3)重启apacheapache
sudo /etc/init.d/apache2 restart 端口修改完毕。apache的端口修改成9000了。
/etc/apache2/sites-available/default # 将/var/www 修改位你的路径: /var/www/html/
/etc/apache2/mods-available/dir.conf # 将 index.* 替换为 xxx.*
不过随apache2的版本不一样 文件的放置位置不同。ubuntu
查看 DirectoryIndex 在apache2哪一个文件里面:grep -iR DirectoryIndex /etc/apache2bash
# 个人Ubuntu 15.04是这样的 root@ubuntu:/etc/apache2/sites-enabled# grep -iR DirectoryIndex /etc/apache2 /etc/apache2/mods-enabled/dir.conf:DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm /etc/apache2/mods-available/dir.conf:DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm