关于apache:Apache修改默认端口

0次阅读

共计 805 个字符,预计需要花费 3 分钟才能阅读完成。

Apache 批改默认端口

1、批改配置文件

(1)批改 /etc/apache2/ports.conf 将

NameVirtualHost *:80
Listen 80
# 改为本人须要的端口
NameVirtualHost *:9000
Listen 9000

(2)有的须要批改 default 和 httpd.conf 配置文件

# 查找配置文件
sudo find / -name default
sudo find / -name httpd.conf

(3)重启 apache

sudo /etc/init.d/apache2 restart
端口批改结束。apache 的端口批改为 9000 了。

2、批改默认网站目录:

/etc/apache2/sites-available/default
# 将 /var/www 批改位你的门路:/var/www/html/

3、批改默认主页文档:

/etc/apache2/mods-available/dir.conf
# 将 index.* 替换为 xxx.*

4、最初

不过随 apache2 的版本不同 文件的搁置地位不一样。

查看 DirectoryIndex 在 apache2 哪个文件外面:grep -iR DirectoryIndex /etc/apache2

# 我的 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

正文完
 0