Centos7下通过Apache(httpd)搭建互联网网站


连接到已注册好的云服务器
www.bslznw.work是已注册好的域名
[root@gaojingbo ~]# ssh 47.106.205.171
[root@aliyunserver ~]# yum -y install httpd mariadb-server mariadb php php-mysql gd php-gd
[root@aliyunserver ~]# systemctl stop firewalld
[root@aliyunserver ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
[root@aliyunserver ~]# systemctl disable firewalld

[root@aliyunserver ~]# systemctl start httpd mariadb
[root@aliyunserver ~]#systemctl enable httpd mariadb


[root@aliyunserver ~]# wget http://down.cssmoban.com/cssthemes5/tope_26_individual.zip

[root@aliyunserver ~]# yum -y install unzip

[root@aliyunserver ~]# unzip tope_26_individual.zip 

[root@aliyunserver ~]# mkdir -p /webroot/bslznw
这个目录下存放H5文件
[root@aliyunserver ~]# mv tope_26_individual/* /webroot/bslznw/
[root@aliyunserver ~]# vim /etc/httpd/conf.d/bslznw.work.conf

<VirtualHost *:8080>
        ServerName www.bslznw.work
        ServerAlias bslznw.work
        DocumentRoot /webroot/bslznw
</VirtualHost>
<Directory "/webroot/bslznw">
        Require all granted
</Directory>


[root@aliyunserver ~]# systemctl restart httpd
[root@aliyunserver ~]# vim /etc/httpd/conf/httpd.comf

#Listen 12.34.56.78:80
Listen 80
Listen 8080

由于是大陆服务器,没有备案,所以使用非80端口
香港服务器不用配置 直接用80端口

这里写图片描述
上面图设置安全组 未备案的添加8080端口,香港服务器或已备案的则添加80端口
这里写图片描述
上面图域名解析
直接输入服务器IP 或网站域名就能看到自己搭建的网站了
这里写图片描述

猜你喜欢

转载自blog.csdn.net/qq_42989565/article/details/81912635