centos7下搭建简单网站

服务器下
[root@gaojingbo ~]# ssh 192.168.122.238

[root@localhost ~]# yum -y install httpd mariadb-server mariadb php php-mysql gd php-gd

[root@localhost ~]# ip a
192.168.122.238
[root@localhost ~]# systemctl stop firewalld.service 
[root@localhost ~]# systemctl disable firewalld.service 
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
[root@localhost ~]# systemctl status firewalld.service 
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

Aug 20 15:22:16 localhost.localdomain systemd[1]: Starting firewalld - dynami...
Aug 20 15:22:17 localhost.localdomain systemd[1]: Started firewalld - dynamic...
Aug 20 15:35:46 kvm-server.com systemd[1]: Stopping firewalld - dynamic fire....
Aug 20 15:35:46 kvm-server.com systemd[1]: Stopped firewalld - dynamic firew....
Hint: Some lines were ellipsized, use -l to show in full.

[root@localhost ~]#  mkdir /var/www/html/aaa.com

[root@localhost ~]# echo 1111 > /var/www/html/aaa.com/index.html
也可以将自己准备好的html文件 拷贝到这里

[root@localhost ~]# mkdir /var/log/httpd/aaa.com

[root@localhost ~]# vim /etc/httpd/conf.d/aaa.com.conf
<VirtualHost 192.168.122.238:80>
DocumentRoot /var/www/html/aaa.com
ServerName www.aaa.com
ServerAlias aaa.com
ErrorLog /var/log/httpd/aaa.com/error_log
CustomLog /var/log/httpd/aaa.com/access_log combined
</VirtualHost>

[root@localhost ~]# httpd -t 
Syntax OK
[root@localhost ~]# systemctl restart httpd

客户端 
[root@gaojingbo ~]# vim /etc/hosts

  127.0.0.1 calhost localhost.localdomain localhost4 localhost4.localdomain4
   ::1         localhost localhost.localdomain localhost6 localhost6.localdomai    n6
  192.168.122.238  www.aaa.com


[root@gaojingbo ~]# firefox www.aaa.com


  • 1
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值