分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 网页技术

apache服务

发布时间:2023-09-06 01:44责任编辑:赖小花关键词:apache

1、搭建apache服务步骤

①准备环境(关闭防火墙service iptables stop,关闭selinux-setenforce 0,配置ip地址)

②装软件包yum install httpd -y

③修改配置文件vim /etc/httpd/conf/httpd.conf

vim /etc/httpd/conf/httpd.conf    //编辑主配置文件
ServerRoot "/etc/httpd"             //设置Apache的主目录
Timeout 120                             //设置请求超时
Listen 80                                  //设置监听端口---重要
ServerAdmin root@sales.com          //设置管理员邮箱
ServerName 192.168.0.3:80           //设置主机或IP
DocumentRoot "/var/www/html"      //设置Apache文档目录---文档根目录--重要
DirectoryIndex index.html               //设置主页文件
AddDefaultCharset GB2312            //设置网站编码

④启动服务

使用service httpd stop可以停止httpd

使用service httpd start 可以启动httpd

使用service httpd restart 可以重启httpd

⑤测试

2、apache服务提供网页服务

3、cd /var/www/html目录中新增a.txt文件并填写内容

4、重启服务service httpd restart

5、访问http://IP地址:监听端口/a.txt

浏览器默认端口号80

默认访问文件index.html,即http://IP地址:监听端口/

apache服务

原文地址:https://www.cnblogs.com/zhengmengfei/p/8515877.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved