丿拔丝丶荳蟲 發表於 2023-6-4 00:00:00

apache虚拟主机配置一例

<div class="codetitle">
        <span><u>复制代码</u></span> 代码如下:</div>
<div class="codebody" id="code17077">
        <br>
        fivetrees extra # cat httpd-vhosts.conf_bak<br>
        #<br>
        # Virtual Hosts<br>
        #<br>
        # If you want to maintain multiple domains/hostnames on your<br>
        # machine you can setup VirtualHost containers for them. Most configurations<br>
        # use only name-based virtual hosts so the server doesn't need to worry about<br>
        # IP addresses. This is indicated by the asterisks in the directives below.<br>
        #<br>
        # Please see the documentation at<br>
        # &lt;URL:http://httpd.apache.org/docs/2.2/vhosts/&gt;<br>
        # for further details before you try to setup virtual hosts.<br>
        #<br>
        # You may use the command line option '-S' to verify your virtual host<br>
        # configuration.<br>
        #<br>
        # Use name-based virtual hosting.<br>
        #<br>
        NameVirtualHost *:80<br>
        #NameVirtualHost *:443<br>
        #<br>
        # VirtualHost example:<br>
        # Almost any Apache directive may go into a VirtualHost container.<br>
        # The first VirtualHost section is used for all requests that do not<br>
        # match a ServerName or ServerAlias in any &lt;VirtualHost&gt; block.<br>
        #<br>
        #&lt;VirtualHost 192.168.1.66&gt;<br>
        #        RewriteEngine On<br>
        #        RewriteMap      lowercase       int:tolower<br>
        #        RewriteMap      vhost   txt:/usr/local/apache/conf/host.txt<br>
        #        RewriteCond     %{HTTP_HOST}    !^$<br>
        #        RewriteCond     ${lowercase:%{HTTP_HOST}|NONE}  ^(.+)$<br>
        #        RewriteRule     ^/(.*...)$ ${vhost:%1...}/$1<br>
        #&lt;/VirtualHost&gt;<br>
        &lt;VirtualHost *:80&gt;<br>
                DocumentRoot /opt/all_dir<br>
                ServerName *<br>
        &lt;/VirtualHost&gt;<br>
        &lt;VirtualHost *:80&gt;<br>
                DocumentRoot /opt/1<br>
                ServerName 1.com<br>
        &lt;/VirtualHost&gt;<br>
        &lt;VirtualHost *:80&gt;<br>
                DocumentRoot /opt/2<br>
                ServerName 2.com<br>
        &lt;/VirtualHost&gt;
        <p>
                 </p>
        <p>
                #&lt;VirtualHost *:443&gt;<br>
                #        DocumentRoot /home/hello<br>
                #        ServerName hello.baidu.com<br>
                #&lt;/VirtualHost&gt;</p>
</div>
<p>
         </p>
頁: [1]
查看完整版本: apache虚拟主机配置一例