Home > Operation and Maintenance > Apache > How apache implements domain name forwarding

How apache implements domain name forwarding

步履不停
Release: 2019-07-26 09:49:46
Original
4473 people have browsed it

How apache implements domain name forwarding

apache安装后,如果想再添加模块,往往不想重新安装一次,再者,我在安装中发现,并不是安装文件中所有的modules都会被默认安装,这次我添加转发模块的过程中,遇到一些问题,为了以后不走弯路,特地记录下来。

端口转发功能

#开启
        RewriteEngine on
        RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
        RewriteRule .* - [F]
Copy after login
  #转发之后地址的域名不转向到IP和端口
        #RewriteCond %{REQUEST_METHOD} !^POST$
        RewriteCond %{HTTP_HOST} ^xx.com.cn
        RewriteRule ^/(.*) http://xxx.xxx.xxx.xxx:9100/$1 [NC,NE,R=301,P]
Copy after login
    #转发之后地址会跳转到IP和端口
        RewriteCond %{HTTP_HOST} ^c.xx.com.cn
        RewriteRule ^/(.*) http://xxx.xxx.xxx.xxx:8001/$1 [NC,NE]
        RewriteRule ^/a/b.html http://xxx.xxx.xxx.xxx:8002/a/b.html [NC,P]
Copy after login
  #例如
        RewriteEngine on
        RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
        RewriteRule .* - [F]
        RewriteCond %{HTTP_HOST} ^m.abc.com.cn
        RewriteRule ^/(.*) http://xxx.xxx.xxx.xxx:8001/$1 [NC,NE]
        
        <VirtualHost *:8001>
            DocumentRoot "/var/www/html/mobile"
            <Directory "/var/www/html/mobile">
                Options FollowSymLinks IncludesNOEXEC Indexes
                DirectoryIndex index.html index.htm index.php
                AllowOverride All
                Order allow,deny
                Allow from all
            </Directory>
        </VirtualHost>
Copy after login

更多Apache的相关技术文章,请访问Apache教程栏目进行学习!

The above is the detailed content of How apache implements domain name forwarding. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Apache automatically stops
From 1970-01-01 08:00:00
0
0
0
apache restart failed
From 1970-01-01 08:00:00
0
0
0
apache error
From 1970-01-01 08:00:00
0
0
0
How apache logs
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template