magento第二课:使用Apache web服务器搭建网站

news/2024/4/27 8:55:24/文章来源:https://blog.csdn.net/weixin_34138255/article/details/88834897

apache2官方文档 http://httpd.apache.org/docs/...

配置文件

# 这是apache主要的服务器配置文件,它包含一些服务器的配置指令,详情参考 http://httpd.apache.org/docs/2.4/ 及查看Debian特殊提示 /usr/share/doc/apache2/README.Debian 
#
#
# 在Debian中Apache2配置工作概述,它与web服务器的配置有一些区别# 被分割成了多个文件,但所有的配置文件还是在 /etc/apache2/ 文件夹中
#
#    /etc/apache2/
#    |-- apache2.conf
#    |    `--  ports.conf
#    |-- mods-enabled
#    |    |-- *.load
#    |    `-- *.conf
#    |-- conf-enabled
#    |    `-- *.conf
#     `-- sites-enabled
#         `-- *.conf
#
#
# * apache2.conf 是主配置文件. 
#
# * ports.conf 最终是包含到上面的主配置文件中. 
#
# * 在mods-enabled/, conf-enabled/ 和 sites-enabled/这几个目录下的配置文件,分别用来管理模块、全局配置片段,虚拟主机配置
#   它们都是 *-available文件夹下的一个符号链接,也就是同windows下的快捷方式是同一种类型,对于是否启用的管理,可以使用以下命令
#   如开启rewrite模块,使用 root@ubuntu:~# a2enmod rewrite,会生成链接/etc/apache2/mods-enabled/rewrite.load,关闭是 a2dismod rewrite
#   同样对虚拟主机命令有 a2ensite和a2dissite,对全局配置有 a2enconf∑ a2disconf
#
# * The binary is called apache2. Due to the use of environment variables, in
#   the default configuration, apache2 needs to be started/stopped with
#   /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
#   work with the default configuration.# 全局配置
##
# ServerRoot: 目录树的顶部,它下面放服务器的配置文件、错误和日志文件
#
# 提示!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the Mutex documentation (available
# at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);
# you will save yourself a lot of trouble.
#
# 不要在目录的结尾加斜杠
#
#ServerRoot "/etc/apache2"#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
Mutex file:${APACHE_LOCK_DIR} default#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE_PID_FILE}#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE_LOG_DIR}/error.log#
# 日志级别: Control the severity of messages logged to the error_log.
# Available values: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the log level for particular modules, e.g.
# "LogLevel info ssl:warn"
#
LogLevel warn# 导入模块配置文件:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf# 导入需要侦听端口的列表
Include ports.conf# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />Options FollowSymLinksAllowOverride NoneRequire all denied
</Directory><Directory /usr/share>AllowOverride NoneRequire all granted
</Directory><Directory /var/www/>Options Indexes FollowSymLinksAllowOverride NoneRequire all granted
</Directory>#<Directory /srv/>
#    Options Indexes FollowSymLinks
#    AllowOverride None
#    Require all granted
#</Directory># AccessFileName: 会在每个文件夹中查该文件,它包含一些附加配置指令,也可参阅指令 AllowOverride
#
AccessFileName .htaccess#
# FilesMatch是一个正则表达式,表示以.ht开头的文件,下面的意思是,象.htaccess 和 .htpasswd这一类以.ht开头的文件,不能被web客户端浏览
<FilesMatch "^\.ht">Require all denied
</FilesMatch>#
# The following directives define some format nicknames for use with
# a CustomLog directive.
#
# These deviate from the Common Log Format definitions in that they use %O
# (the actual bytes sent including headers) instead of %b (the size of the
# requested file), because the latter makes it impossible to detect partial
# requests.
#
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
# Use mod_remoteip instead.
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf# 导入虚拟主机的配置:
IncludeOptional sites-enabled/*.conf# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

虚拟主机设置
参考指令<VirtualHost> http://httpd.apache.org/docs/...
建配置文件/etc/apache2/sites-available/www.chuse.store.conf,内容如下

<VirtualHost *:80>ServerAdmin wang@chuse.storeDocumentRoot /var/www/chuse/storeServerName www.chuse.storeErrorLog /var/log/apache2/www.chuse.store-error_logTransferLog /var/log/apache2/www.chuse.store-access_log
</VirtualHost>

启动网站

root@ubuntu:~# a2ensite www.chuse.store.conf
root@ubuntu:~# service apache2 restart

建一个测试文件 /var/www/chuse/store/index.php

修改宿主机中C:\Windows\System32\drivers\etc\hosts,加一行127.0.0.1 www.chuse.store

目录映射

参考 https://www.jianshu.com/p/223...
参考 https://www.cnblogs.com/xing9...

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_754992.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Spring cloud实战 从零开始一个简单搜索网站_Hystrix断路由的实现(三)

上文已经完成了一个简单的 浏览器 到 Client 到CSDN端的通路 我们的架构是每个博客网址为一个单独的组件&#xff0c; 这里为了方便直接先用CSDN 那个组件复制下 我这里改成 SDN 修改下 application.properties 端口记得改 eureka.client.serviceUrl.defaultZonehttp://loc…

直面春招!java相关技术网站

面试进大厂必问知识点内容 细节见真知:计算向数据移动、而非数据向计算移动 redis的5大Value类型解析 redis实现活跃用户/用户统计 redis实现秒杀/抢购 redis实现排行榜/评论列表 redis实现推荐系统/抽奖/商品详情页 linux系统的支持: fork、 copy on write redis的持久…

看完全都会了!java语言程序设计与数据结构配套网站

微服务是什么 微服务起源于2005年Peter Rodgers博士在云端运算博览会提出的微Web服务(Micro-Web-Service)&#xff0c;根本思想类似于Unix的管道设计理念。2014年&#xff0c;由Martin Fowler 与 James Lewis共同提出了微服务的概念&#xff0c;定义了微服务架构风格是一种通过…

JEECG-P3首个开源插件诞生!CMS网站插件 Jeecg-p3-biz-cms1.0版本发布!

为什么80%的码农都做不了架构师&#xff1f;>>> Jeecg-P3-Biz-Cms &#xff08; JEECG 首个微服务插件&#xff0c;支持小程序的CMS系统&#xff09; 是基于JEECG-P3 微服务框架开发的CMS建站系统&#xff0c;可轻量级集成进jeecg系统&#xff0c;定制各类网站模…

【必看】分析各大招聘网站

目前市场上的招聘网站鱼龙混杂&#xff0c;人力资源市场这块大蛋糕谁都想分一块。工作对于每个人来说都是人生中的一件大事&#xff0c;所以如何选择一个适合自己的经验水平等各方面的正规招聘网站就显得尤为重要&#xff0c;那么今天小编就从客观角度&#xff0c;为大家分析市…

一个基于 SpringBoot 开源的小说和漫画在线阅读网站,简洁大方 !强烈推荐 !...

点击上方“Java基基”&#xff0c;选择“设为星标”做积极的人&#xff0c;而不是积极废人&#xff01;源码精品专栏 原创 | Java 2020 超神之路&#xff0c;很肝~中文详细注释的开源项目RPC 框架 Dubbo 源码解析网络应用框架 Netty 源码解析消息中间件 RocketMQ 源码解析数据库…

解决.net网站打开出现编译器错误消息: CS0016: 未能写入输出文件问题

今天魅力网络在win2008上搭建一个wap的网站程序是asp.net的&#xff0c;发现打开后无法显示&#xff0c;asp的网站可以打开&#xff0c;但asp.net的还是打不开&#xff0c;点基本设置那测试权限了通过了照样打不开&#xff0c;iis的asp.net组件都已经安装了啊&#xff0c;为什么…

IIS安装网站安装发布流程

1.安装IIS打开控制面板---程序和功能选择启用或关闭Windows功能2. 注册IIS因为我们是先安装的VS&#xff0c;后安装的IIS&#xff0c;所以需要将IIS注册进VS中&#xff0c;具体方法如下&#xff1a;在运行中输入“cmd”,回车进入Dos界面上面命令的意思是进入到C:\Windows\Micro…

如何快速实现一个基于Nginx网站的监控场景

一切从应用服务监控说起 小明所在的一家小型互联网创业公司一直将应用运行在阿里云上。该应用采用通用的分布式 NginxApp 架构为用户提供电商数据统计的 webservice 服务。应用运行至今除偶发各类 Bug&#xff0c;性能问题以外&#xff0c;情况还算良好。 undefined 最近&#…

【转载】如何查看自己网站的搜索引擎收录量和索引量

针对于个人站长或者企业站长而言&#xff0c;一般都非常关注自己网站的收录情况以及索引量信息&#xff0c;针对于新上线的网站&#xff0c;搜索引擎一般都还会给予新站保护期进行保护。其实如果要查看自己网站的收录量以及索引量等&#xff0c;可以注册百度站长平台、搜狗站长…

【转载】通过百度站长平台查看网站搜索流量及关键字

无论是个人站还是企业站&#xff0c;都希望网站内容丰富后&#xff0c;网上用户可以通过搜索引擎搜索到网站的内容信息&#xff0c;其实如果站长已经入住了百度站长平台&#xff0c;则我们可以通过百度站长平台的数据监控功能中的查看流量和关键词的菜单来查看具体多少用户通过…

【转载】通过搜狗站长平台查看网站的搜狗流量及搜索关键字

无论是个人站还是企业站&#xff0c;都希望网站内容丰富后&#xff0c;网上用户可以通过搜索引擎搜索到网站的内容信息&#xff0c;其实如果站长已经入住了搜狗站长平台&#xff0c;则可以通过搜狗站长平台的数据监控功能中的查看流量和关键词的菜单来查看具体多少用户通过搜狗…

【转载】通过搜狗站长平台提交网站域名变更后的文章地址

在实际的网站运维过程中&#xff0c;有时候可能会进行网站域名信息的变更&#xff0c;将一个网站的内容全部迁移到另一个域名下&#xff0c;之前的网站域名作废的情况&#xff0c;如果网站收录量不多&#xff0c;直接迁移即可&#xff0c;如果网站收录量很多&#xff0c;则可能…

【转载】通过百度站长平台提交网站死链

运维过网站的人员都知道&#xff0c;网站在运维过程中&#xff0c;因为各种原因如文章删除、网站改版等原因会产生一些失效的网页链接&#xff0c;即我们通常所说的死链&#xff0c;如果死链过多&#xff0c;可能会影响到搜索引擎对我们网站质量权重的判定以及造成不好的用户体…

Redis升级到 6.x 版本后,12306网站起飞了!

提起业务量&#xff0c;除了京东618&#xff0c;淘宝双11&#xff0c;当数全民抢票平台 12306最有发言权。后台有位粉丝问了个很典型的问题&#xff0c;同样是架设在阿里云上的服务器&#xff0c;为什么12306经常会宕机&#xff0c;而双11阿里每秒钟50多万笔订单&#xff0c;都…

获取了网站源码有什么用_环保做推广用什么平台_广告投放-多网站信息推广

环保做推广用什么平台_广告投放-多网站信息推广 讯呱呱(深圳)网络科技有限公司成立于2020-06-18&#xff0c;法定代表人为刘宪玲&#xff0c;注册资本为101万元&#xff0c;统一社会信用代码为91440300MA5G8KKX6D。企业地址位于深圳市龙华区龙华街道清华社区和平路64号中国振华…

怎样获取网站的域名_网站如何被百度收录?

百度搜索引擎对网站的收录与很多方面的因素有关&#xff0c;网站如果想要得到百度搜索引擎收录的话&#xff0c;站长需要不断对网站的整体结构进行调整和完善&#xff0c;从网站结构、内容、链接等细节方面着手优化&#xff0c;才能突破收录困境&#xff0c;循序渐进的提升网站…

教你用 docker 搞个网站

点击上方“Java基基”&#xff0c;选择“设为星标”做积极的人&#xff0c;而不是积极废人&#xff01;每天 14:00 更新文章&#xff0c;每天掉亿点点头发...源码精品专栏 原创 | Java 2021 超神之路&#xff0c;很肝~中文详细注释的开源项目RPC 框架 Dubbo 源码解析网络应用框…

web文件 群晖_群晖NAS安装wordpress博客,构建属于自己的web网站

学习网络技术的话可以关注我&#xff0c;每天都会有相应的教程发布的&#xff01;群晖NAS主要的作用就是网络储存&#xff0c;你可以理解为百度云&#xff0c;但这个百度云的服务器放在了家里。个人而言&#xff0c;有了NAS以后&#xff0c;家里的所有设备(台式电脑&#xff0c…

# 解析bt文件_一键查看BT下载记录,用这网站一秒知道你下载过哪些资源

既然刷到了&#xff0c;就收藏起来吧&#xff01;以备不时之需&#xff01;想要知道自己过去用BT或磁力链下载过哪些电影、游戏或软件等资源吗&#xff1f;你可能还不知道&#xff0c;其实在 BT 下载时&#xff0c;自己的 IP 位置就已经被记录&#xff0c;通过「iknowwhatyoudo…