查看“Apache 重写文件映射规则”的源代码
←
Apache 重写文件映射规则
跳到导航
跳到搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看和复制此页面的源代码。
<syntaxhighlight lang="shell"> [root@iZ8vbcjkeqbrdmmbt23vboZ ~]# docker exec -it aade5ae73079 bash root@aade5ae73079:/var/www/html# vim /etc/apache2/sites-enabled/000-default.conf <VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf AllowEncodedSlashes NoDecode RewriteEngine on RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^videos/([^/\.]+)\.mp4$ /var/www/videos/$1.mp4 [L] RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R] </VirtualHost> </syntaxhighlight>在Apache的RewriteRule规则中,[L]标志表示“最后一个”或“最后的”标志(Last Flag)。 它指示Apache在应用规则后停止处理其他规则。 如果[L]标志未设置,则Apache将继续处理其余的规则。<syntaxhighlight lang="shell"> root@aade5ae73079:/var/www/html# service apache2 restart Restarting Apache httpd web server: apache2Terminated root@aade5ae73079:/var/www/html# [root@iZ8vbcjkeqbrdmmbt23vboZ ~]# [root@iZ8vbcjkeqbrdmmbt23vboZ ~]# docker start aade5ae73079 aade5ae73079 </syntaxhighlight>
返回至
Apache 重写文件映射规则
。
导航菜单
个人工具
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
Spring Boot 2 零基础入门
Spring Cloud
Spring Boot
设计模式之禅
VUE
Vuex
Maven
算法
技能树
Wireshark
IntelliJ IDEA
ElasticSearch
VirtualBox
软考
正则表达式
程序员精讲
软件设计师精讲
初级程序员 历年真题
C
SQL
Java
FFmpeg
Redis
Kafka
MySQL
Spring
Docker
JMeter
Apache
Linux
Windows
Git
ZooKeeper
设计模式
Python
MyBatis
软件
数学
PHP
IntelliJ IDEA
CS基础知识
网络
项目
未分类
MediaWiki
镜像
问题
健身
国债
英语
烹饪
常见术语
MediaWiki帮助
工具
链入页面
相关更改
特殊页面
页面信息