常用Apache的httpd的conf配置

常用Apache的httpd的conf配置

  • 静态目录
  • 请求转发
  • www跳转
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#指向一个静态目录 该目录下有index.html
<VirtualHost *:80>
ServerName dsshow.xxx.com
DocumentRoot "D:\projects\cms_pc_close"
</VirtualHost>

#转发配置
<VirtualHost *:80>
ServerName trends.xxx.com
ProxyPass /wechat/sign http://hset-wechat-share.xxx.com:8093/wechat/sign
ProxyPassReverse /wechat/sign http://hset-wechat-share.xxx.com:8093/wechat/sign

ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
ErrorLog "|bin/rotatelogs.exe logs/trends.xxx.com-error_%Y_%m_%d.log 86400 480"
CustomLog "|bin/rotatelogs.exe logs/trends.xxx.com-access_%Y_%m_%d.log 86400 480" common
</VirtualHost>

#配置不带www域名网站转跳到带www
<VirtualHost *:80>
ServerName www.cgmtxxx.com
ProxyPass / http://www.cgmtxxx.com:8084/
ProxyPassReverse / http://www.cgmtxxx.com:8084/
ErrorLog "|bin/rotatelogs.exe logs/www.cgmtxxx.com-error_%Y_%m_%d.log 86400 480"
</VirtualHost>
#这里配置非www转向的
<VirtualHost *:80>
ServerName cgmtxxx.com
RedirectMatch permanent ^/(.*) http://www.cgmtxxx.com/$1
</VirtualHost>
-------------已经触及底线 感谢您的阅读-------------

本文标题:常用Apache的httpd的conf配置

文章作者:趙小傑~~

发布时间:2018年01月18日 - 21:46:04

最后更新:2019年07月26日 - 23:32:12

原始链接:https://cnsyear.com/posts/2060cdd8.html

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。

0%