1. 安装
在Fedora/CentOS/Red Hat Enterprise Linux上安装
sudo yum install httpd
sudo systemctl enable httpd
sudo systemctl start httpd
在Ubuntu/Debian上安装
sudo apt install apache2
sudo service apache2 start
2. 启动/重启/停止
启动
apachectl start
systemctl start httpd
重启
apachectl restart -k
systemctl restart httpd
停止
apachectl -k stop
systemctl stop httpd.service
查看版本
httpd -v
3. 修改配置
配置文件的路径:/etc/httpd/conf/httpd.conf
编辑此文件,修改端口号为8090,访问/log默认访问到/var/www/log
Alias /log "/var/www/log"
<Directory "/var/www/log">
Options +Indexes
AllowOverride None
# Allow open access:
Require all granted
</Directory>
访问主机:
更多设置访问官网:https://httpd.apache.org/docs/2.4/https://httpd.apache.org/docs/2.4/