httpd介绍
Apache HTTP Server(简称Apache)是Apache软件基金会的一个开放源码的网页服务器,可以在大多数计算机操作系统中运行,
由于其多平台和安全性被广泛使用,是最流行的Web服务器端软件之一。它快速、可靠并且可通过简单的API扩展,将Perl/Python等解释器编译到服务器中。
安装 + 启动 + 开机启动
以center OS为例:
$ sudo yum install httpd -y
$ sudo systemctl start httpd
$ sudo systemctl enable httpd
修改端口号
因为默认端口80已经被其他应用(我的是自己安装的wiki)占用,所以修改默认端口号.
将Listen 80中的80修改为需要的端口号如8010,同时在#ServerName www.example.com:80下添加ServerName localhost:8010
$ sudo vim /etc/httpd/conf/httpd.conf
启动
$ sudo systemctl start httpd
$ sudo systemctl enable httpd
启动报错
报错提示:
httpd: Could not reliably determine the server’s fully qualified domain name
原因:
在配置中配置在ServerName为localhost:port,port为端口号
访问
http://localhost:8010 可以看到:
