apache2修改默认端口

apache2的默认端口是80端口,但80这个端口一般都是被其他服务占用的,
所以为了避免冲突,有时候我们需要修改下apache2的端口。
apache2的配置端口的文件在/etc/apache2内的ports.conf文件中
首先打开终端进入appache2的配置文件夹

cd /etc/apache2/

使用vi编辑器进入编辑模式

sudo vi ports.conf 

把80端口改成自己想改的端口(我这里把80端口改成980端口,将443端口改为9443端口)
改完保存并退出
重启apache2

sudo /etc/init.d/apache2 restart

本机设置前为:

# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen 80
<IfModule ssl_module>
Listen 443
</IfModule>

<IfModule mod_gnutls.c>
Listen 443
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

本机设置后为:

# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen 980
<IfModule ssl_module>
Listen 9443
</IfModule>

<IfModule mod_gnutls.c>
Listen 9443
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

评论

  1. 博主
    4月前
    2023-6-01 1:46:06

    1

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇