电影推荐系统-环境搭建(九)

 

安装Apache-用户可视化(实现前后端分离)

1)安装Apache

[root@tjx1 kafka_2.12-0.10.2.1]# yum install httpd

2)启动Apache

[root@tjx1 kafka_2.12-0.10.2.1]# service httpd start

 

发现启动失败了

错误原因:根据提示使用 /bin/systemctl start httpd.service启动

3)查看Apache可视化界面

192.168.212.21:80

访问80端口

发现出现的是这个:

 

翻译一下:

此页面用于测试Apache HTTP服务器在安装后的适当操作。如果你可以阅读这个页面,这意味着这个网站工作正常。此服务器由CentOS运行。

解决方法:

1. 找到一个叫做welcome.conf的文件,一般在/etc/httpd/conf.d

2. 把这个文件的所有行都注释掉,即前面加上#,这样就不会执行此Apache 2测试页面了。

原文件内容如下:

#

# This configuration file enables the default "Welcome" page if there

# is no default index page present for the root URL.  To disable the

# Welcome page, comment out all the lines below.

#

# NOTE: if this file is removed, it will be restored on upgrades.

#

<LocationMatch "^/+$">

    Options -Indexes

    ErrorDocument 403 /.noindex.html

</LocationMatch>

 

<Directory /usr/share/httpd/noindex>

    AllowOverride None

    Require all granted

</Directory>

 

Alias /.noindex.html /usr/share/httpd/noindex/index.html

Alias /noindex/css/bootstrap.min.css /usr/share/httpd/noindex/css/bootstrap.min.css

Alias /noindex/css/open-sans.css /usr/share/httpd/noindex/css/open-sans.css

Alias /images/apache_pb.gif /usr/share/httpd/noindex/images/apache_pb.gif

Alias /images/poweredby.png /usr/share/httpd/noindex/images/poweredby.png

 

修改之后内容如下:

 

3.停止Apache重启

[root@tjx1 conf.d]# /bin/systemctl stop httpd.service

[root@tjx1 conf.d]# /bin/systemctl start httpd.service

看到的是这样的:

 

这是因为没有设置默认页面,导致APACHE直接把文件目录给列出来

解决方法

建立一个默认页面,一般都是index.htm或index.html,这个可以在APACHE的httpd.conf里设置的,

新建一个文件:

[root@tjx1 html]# pwd

/var/www/html

[root@tjx1 html]# vi index.html

填入内容:

<h1>tjx1_0901</h1>

然后刷新页面即可看到:

 

这样就实现前后端的分离了

4)关闭Apache

/bin/systemctl stop httpd.service

博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3