首页 > 其他分享 >Apache 服务搭建

Apache 服务搭建

时间:2023-12-01 17:38:18浏览次数:32  
标签:httpd 服务 -- sum server Apache root el7 搭建

Apache

一.了解apache

Apache(或httpd)是Internet上使用最多的Web服务器技术之一,使用的传输协议是http(Hypertext Transfer Protocol),超文本传输协议,这是一个基于超文本的协议,用于通过网络连接来发送和接受对象。【还有一个是httpds(http的加密版本)】


  • http使用80/tcp端口

  • https使用443/tcp端口


搭建httpd服务
1.有用镜像yum源(大多数linux镜像自带httpd软件包)
2.安装httpd服务
3.关闭防火墙
4.开启httpd服务且设置开机自启
5.访问httpd默认访问界面(测试服务)

实操:
1.配置yum仓库

[root@server ~]# vim /etc/yum.repos.d/local.repo 

[local]
name=redhat
baseurl=file:///media
enabled=1
gpgcheck=0

2.安装httpd服务

[root@server ~]# yum install -y httpd
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
local                                                      | 4.1 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-45.el7 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-45.el7 for package: httpd-2.4.6-45.el7.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-45.el7.x86_64
--> Running transaction check
---> Package httpd-tools.x86_64 0:2.4.6-45.el7 will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================
 Package              Arch            Version                Repository      Size
==================================================================================
Installing:
 httpd                x86_64          2.4.6-45.el7           local          1.2 M
Installing for dependencies:
 httpd-tools          x86_64          2.4.6-45.el7           local           84 k
 mailcap              noarch          2.1.41-2.el7           local           31 k

......

Complete!

3.关闭防火墙

[root@server ~]# systemctl  stop firewalld.service 
或者
firewall-cmd --permanent --add-service=http

4.开启服务且设置开机自启

[root@server conf]# systemctl start httpd

[root@server conf]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

5.访问默认网站
在客户端访问
windows:
打开浏览器输入http://192.168.10.10(配有apache服务的主机ip)
image

linux:
curl http://192.168.10.10(或者使用火狐浏览器同windows)

搭建个人网站
1.新建用户
2.修改用户的配置文件
3.为用户编写一个网页文件
4.修改网页文件的访问权限
5.重启apache服务
6.客户端访问测试

1.新建用户

[root@server ~]# useradd  sum
[root@server ~]# passwd sum 
Changing password for user sum.
New password: 
BAD PASSWORD: The password is a palindrome
Retype new password: 
passwd: all authentication tokens updated successfully.

2.修改用户的配置文件
image
UserDir enabled (改disabled为enabled) 开启
UserDir public_html (去#注释)
3.为用户编写一个网页文件

[root@server conf.d]# cd /home/sum/
[root@server sum]# ls
[root@server sum]# vim index.html
[root@server sum]# ls
[root@server sum]# echo "hello,this's my first web" >> index.html
[root@server sum]# ls
index.html

4.修改网页文件的访问权限

[root@server sum]# chmod o+x /home/sum/
(修改其他人的访问权写)

5.重启apache服务

[root@server sum]# systemctl  restart httpd.service

6.客户端访问测试

标签:httpd,服务,--,sum,server,Apache,root,el7,搭建
From: https://www.cnblogs.com/humlogs/p/17870436.html

相关文章

  • Visual Studio2022创建Windows服务程序
    一、打开工具 二、创建新项目     创建后项目结构 三、重命名服务   四、添加安装程序     五、编码服务逻辑  usingSystem.ServiceProcess;usingSystem.Timers;usingSystem.Windows.Forms;namespaceMyAlertWindows......
  • XmlRPC入门_基于组合类型的客户端、服务端
    1、客户端#include<stdlib.h>#include<stdio.h>#include<xmlrpc-c/base.h>#include<xmlrpc-c/client.h>#include"config.h"/*informationaboutthisbuildenvironment*/#defineNAME"Xmlrpc-cTestClient"#d......
  • XmlRPC入门_基于C的服务端、客户端
    以下客户端与服务端的代码内容为官网给出的示例,此处拷贝记录,了解基础使用方式。1、服务端#include<iostream>#include<winsock2.h>#include<windows.h>#include"xmlrpc-c/base.h"#include"xmlrpc-c/server.h"#include"xmlrpc-c/server_abyss.h"#incl......
  • k8s集群部署nginx服务以及外网访问nginx服务
    1、查看k8s进群状态[root@k8s-mastertest]#kubectlgetnodeNAMESTATUSROLESAGEVERSIONk8s-masterReadymaster16dv1.15.1k8s-node1Ready<none>16dv1.15.12、编写nginx服务yaml文件kind:NamespaceapiVersion:v1metad......
  • Sentinel 微服务保护
    Sentinel微服务保护​#Sentinel#​本文章为个人摘抄笔记,原文章来源于www.cnblogs.com/xiegongz...‍Sentinel是阿里巴巴开源的一款微服务流量控制组件。官网地址:https://sentinelguard.io/zh-cn/index.html雪崩问题与解决方式所谓的雪崩指的是:微服务之间相互调用,调用链......
  • Linux:查看MobaXterm已保存的服务器密码
    打开MobaXterm,Settings-->Configuration-->General--> MobaXtermpasswordsmanagement,选择需要查看的Session所在行,点击“Showpasswords”,弹出MobaXterm密码输入框......
  • 搭建订阅转换网站
    项目地址前端:https://github.com/CareyWang/sub-web后端:https://github.com/tindy2013/subconverter安装前端安装node.js和yarn需要先更新系统并安装Node.js和Yarn(ubuntu/debina为例,安装的是14.x版本,其他版本自行替换)aptupdate-ycurl-fsSLhttps://deb.node......
  • Gradio-Lite: 完全在浏览器里运行的无服务器 Gradio
    Gradio是一个经常用于创建交互式机器学习应用的Python库。在以前按照传统方法,如果想对外分享Gradio应用,就需要依赖服务器设备和相关资源,而这对于自己部署的开发人员来说并不友好。欢迎Gradio-lite(@gradio/lite):一个通过Pyodide在浏览器中直接运行Gradio的库。在......
  • ubuntu部署gitlab服务器
    ubuntu部署gitlab服务器笔者使用的ubuntu版本为20.04,gitlab版本为16.2.1(此篇文章部分引用他人文件,单纯记录,如有侵权请联系)1、更新命令cd/homemkdirgitlabcd/gitlabsudoaptupdatesudoapt-getupgradesudoapt-getinstallcurlopenssh-serverca-certificates......
  • 个推文档 > 服务端 > C# > 快速入门
    转自:https://docs.getui.com/getui/server/csharp/start/.NETCore版本个推C#SDK支持.NetCore版本,可以到后面的网址去下载的.NetSDK(版本要求>=2.2):(https://dotnet.microsoft.com/download/)下载个推C#Demo, .NETCoredemo 目录结构如下图所示: ......