赞
踩
yum install httpd -y
rpm -qa httpd
systemctl start httpd.service
systemctl rehttpd.service
[root@localhost ~] echo "192.168.137.137 www.dduan.com">>/etc/hosts
[root@localhost ~] tail -1 /etc/hosts
192.168.137.137 www.dduan.com
[root@localhost ~]# echo "http://www.$HOSTNAME">/var/www/html/index.html
[root@localhost ~]# cat /var/www/html/index.html
http://www.dduan.com
[root@localhost ~]# curl http://www.dduan.com
http://www.http://www.dduan.com.com
[root@localhost ~]# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.$(date +%F)
[root@localhost ~]# ll /etc/httpd/conf/httpd.conf
-rw-r--r-- 1 root root 11753 Nov 15 00:53 /etc/httpd/conf/httpd.conf
-rw-r--r-- 1 root root 11753 Jan 10 18:42 /etc/httpd/conf/httpd.conf.2018-12-05
[root@localhost httpd]# mkdir /etc/httpd/vhost.d/
[root@localhost httpd]# echo "include vhost.d/*.conf"
[root@localhost httpd]# tail -1 /etc/httpd/conf/httpd.conf
include vhost.d/*.conf
<VirtualHost *:80>
ServerAdmin admin@amsilence.com
DocumentRoot "/var/www/html/"
ServerName blog.dduan.com
ErrorLog "/var/log/httpd/logs/error_log"
CustomLog "/var/log/httpd/logs/access_log" common
</VirtualHost>
<Directory /var/www/html/>
Require all granted
</Directory>
[root@localhost httpd]# /sbin/service httpd configtest
Syntax OK
systemctl rehttpd.service
[root@localhost html]# curl www.dduan.com
www.dduan.com
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。