建動畫網(wǎng)站需要多少錢關(guān)鍵詞排名查詢工具免費
要求如下:
- 建立一個使用web服務(wù)器默認(rèn)端口的網(wǎng)站,設(shè)置DocumentRoot為/www/port/80,網(wǎng)頁內(nèi)容為:the port is 80。
- 建立一個使用10000端口的網(wǎng)站,設(shè)置DocumentRoot為/www/port/10000,網(wǎng)頁內(nèi)容為:the port is 10000。
注:此時子配置不必再監(jiān)聽80端口
?準(zhǔn)備工作:web服務(wù)器搭建
第一步:掛載
[root@localhost node1]# mount /dev/sr0 /mnt/
第二步:編輯配置文件
[root@localhost node1]# vim /etc/yum.repos.d/web.repo
[BaseOS]
name=BaseOS
baseurl=file:///mnt/BaseOS
gpgcheck=0[AppStream]
name=AppStream
baseurl=file:///mnt/AppStream
gpgcheck=0
第三步:安裝軟件包
[root@localhost node1]# dnf install httpd -y
[root@localhost ~]# rpm -ql httpd
[root@localhost httpd]# tree /etc/httpd
/etc/httpd
├── conf
│ ├── httpd.conf
│ └── magic
├── conf.d
│ ├── autoindex.conf
│ ├── README
│ ├── userdir.conf
│ └── welcome.conf
├── conf.modules.d
│ ├── 00-base.conf
│ ├── 00-dav.conf
│ ├── 00-lua.conf
│ ├── 00-mpm.conf
│ ├── 00-proxy.conf
│ ├── 00-systemd.conf
│ └── 01-cgi.conf
├── logs -> ../../var/log/httpd
├── modules -> ../../usr/lib64/httpd/modules
└──
run -> /run/httpd
第四步:啟動httpd
[root@localhost node1]# systemctl start httpd.service
注:1、啟動用start,再次啟動用restart,2、.service后綴可加可不加
查看配置文件:
[root@localhost node1]# rpm -ql httpd | grep etc
第五步:設(shè)置防火墻狀態(tài):
[root@localhost ~]# systemctl status firewalld
[root@localhost ~]#systemctl stop firewalld#可不用
[root@localhost ~]#systemctl disable firewalld
注意: systemctl start/restart/enable/disable/stop/status/reload 的區(qū)別 ?
重啟服務(wù):
[root@localhost ~]# systemctl restart httpd
查看狀態(tài): ?
?查看是否啟動成功:
[root@localhost node1]# systemctl is-active httpd
active##測試狀態(tài)代碼
[root@localhost node1]# systemctl stop httpd.service
[root@localhost node1]# systemctl is-active httpd
inactive
第六步:測試
- 在客戶端:curl http://ip地址, curl -I 可以查看http報文信息
- 通過瀏覽器訪問http://ip地址 ?
第一步、啟動httpd
[root@localhost node1]# systemctl start httpd.service
注:1、啟動用start,再次啟動用restart,2、.service后綴可加可不
第二步、設(shè)置防火墻狀態(tài):
[root@localhost ~]# systemctl status firewalld
[root@localhost ~]#systemctl stop firewalld
##也可用這個命令
[root@localhost ~]#systemctl disable firewalld
注意: systemctl start/restart/enable/disable/stop/status/reload 的區(qū)別 ?
默認(rèn)防火墻建立22端口連接
關(guān)閉文件訪問權(quán)限——SeLinux
[root@localhost html]# setenforce 0
注:臨時生效命令
第三步,定義基于不同端口來訪問網(wǎng)站的配置文件
示例文件:
[root@localhost node1]# rpm -ql httpd | grep vhosts.conf
/usr/share/doc/httpd/httpd-vhosts.conf
[root@localhost node1]# vim /usr/share/doc/httpd/httpd-vhosts.conf
[root@localhost node1]# vim /etc/httpd/conf.d/httpd-vhosts.conf
<VirtualHost 192.168.17.171:80>ServerName 192.168.17.171DocumentRoot /www/port/80
</VirtualHost>
?
LISTEN 10000
?
<VirtualHost 192.168.17.171:10000>ServerName 192.168.17.171DocumentRoot /www/port/10000
</VirtualHost>
?
<Directory /www>AllowOverride noneRequire all granted
</Directory>
第四步,創(chuàng)建兩個網(wǎng)頁文件根目錄,并定義網(wǎng)頁內(nèi)容
[root@localhost ~]# mkdir -pv /www/port/{80,10000}
[root@localhost ~]# echo the port is 80 > /www/port/80/index.html
[root@localhost ~]# echo the port is 10000 > /www/port/10000/index.html
[root@localhost node1]# curl 192.168.17.171:80
the port is 80
[root@localhost node1]# curl 192.168.17.171:10000
the port is 10000
?第五步:測試
?