修改apache服务器默认的端口号,关于apache:Apache修改默认端口

本文详细介绍了如何在Apache中修改默认端口,包括修改ports.conf和相关配置文件,以及调整默认网站目录和主页文档。步骤适用于不同版本的Apache。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值