服务器建设~引入Apache~
我将从假设已经在VPS上安装了Linux的状态开始。请参考下面的链接:
https://knowledge.sakura.ad.jp/8218/
1. 更新软件包管理工具yum
$ sudo yum -y update
2. 安装名为yum-cron的软件包,它可自动处理使用yum进行的系统更新。
$ sudo yum -y install yum-cron
在编辑器中编辑/etc/yum/yum-cron.conf文件。
apply_updates = no ← ここを
apply_updates = yes ← に変更
启动yum-cron服务,并使其自动启动生效。
$ sudo systemctl start yum-cron.service
$ sudo systemctl enable yum-cron.service
5. 安装Apache
$ sudo yum -y install httpd
更改设置
编辑httpd.conf文件
$ sudo nano /etc/httpd/conf/httpd.conf
在编辑器中编辑以下内容。
(変更前) #ServerName www.example.com:80
(変更後) ServerName www.example.com
在进行更改后进行语法检查。
$ httpd -t
如果显示语法OK,则表示OK。
7. 启动Apache。
$ sudo systemctl start httpd.service
在系统启动时设置为自动启动
$ sudo systemctl enable httpd.service
八、防火墙设置
允许访问80端口
$ sudo firewall-cmd --permanent --add-service=http
success
$ sudo firewall-cmd --reload
success