Linux - apache 服務
阿新 • • 發佈:2018-08-12
firewalld 配置 分享 修改 png 分享圖片 htm sta install
暫時關閉 iptables 防火墻
[root@sch01ar ~]# systemctl stop iptables.service
暫時關閉 firewall 防火墻
[root@sch01ar ~]# systemctl stop firewalld
暫時關閉 selinux
[root@sch01ar ~]# setenforce 0
安裝軟件包
[root@sch01ar ~]# yum install httpd -y
查看配置文件
[root@sch01ar ~]# vim /etc/httpd/conf/httpd.conf
ServerRoot 為配置文件根目錄
Listen 為 apache 服務監聽的端口
Include 為包含的配置文件
DocumentRoot 為網站根目錄
Errorlog 為錯誤日誌,LogLevel 為錯誤級別
重啟 apache 服務
[root@sch01ar ~]# systemctl restart httpd.service
查看 ip 地址
在網站根目錄 /var/www/html 下創建一個 index.html 內容為 test
訪問
修改主機信息
[root@sch01ar html]# vim /etc/hosts
添加一條記錄
添加上這一條
訪問該域名就會訪問該 ip 地址
因為沒有解析,所以只能本機訪問該域名
Linux - apache 服務