apache多端口, 多ip, 多域名配置示例

by pxz


发布于: 2011-07-11 所属分类: 服务器 apache 标签:  600


<h3 id="h3--"><a name="一. 多端口配置" class="reference-link"></a><span class="header-link octicon octicon-link"></span>一. 多端口配置</h3><pre><code>Listen 81 <VirtualHost *:81> DocumentRoot "/opt/www/81" </VirtualHost> <Directory "/opt/www/81"> Options Indexes FollowSymLinks AllowOverride all Order Deny,Allow Allow from all require all granted DirectoryIndex index.html index.htm index.php #主页文件的设置 </Directory> Listen 82 <VirtualHost *:82> DocumentRoot "/opt/www/82" </VirtualHost> <Directory "/opt/www/82"> Options Indexes FollowSymLinks AllowOverride all Order Deny,Allow Allow from all Require all granted DirectoryIndex index.html index.htm index.php #主页文件的设置 </Directory> # FollowSymLinks: 在该目录下允许文件系统使用符号连接 # Indexes: 当用户访问该目录时,如果用户找不到DirectoryIndex指定的主页文件(例如index.html),则返回该目录下的文件列表给用户 # AllowOverride:允许存在于.htaccess文件中的指令类型, 值为None时, 不搜索该目录下的.htaccess文件(可以减小服务器开销), 值为All时: 在.htaccess文件中可以使用所有的指令 # Order:控制在访问时Allow和Deny两个访问规则哪个优先 # require all granted : 允许所有请求访问资源 </code></pre><h3 id="h3--ip-"><a name="二. 多ip, 多域名配置" class="reference-link"></a><span class="header-link octicon octicon-link"></span>二. 多ip, 多域名配置</h3><pre><code>NameVirtualHost 46.37.177.154:80 <VirtualHost 46.37.177.154:80> DocumentRoot "/opt/www/www.demo.com" ServerName www.demo.com ServerAlias demo.com. *.demo.com </VirtualHost> <Directory "/opt/www/www.demo.com"> Options Indexes FollowSymLinks AllowOverride all Order Deny,Allow Allow from all Require all granted DirectoryIndex index.html index.htm index.php #主页文件的设置 </Directory> <VirtualHost 46.37.177.154:80> DocumentRoot "/opt/www/www.demo01.com" ServerName www.demo01.com ServerAlias demo01.com. *.demo01.com </VirtualHost> <Directory "/opt/www/www.demo01.com"> Options Indexes FollowSymLinks AllowOverride all Order Deny,Allow Allow from all Require all granted DirectoryIndex index.html index.htm index.php #主页文件的设置 </Directory> NameVirtualHost 46.37.177.155:80 <VirtualHost 46.37.177.155:80> DocumentRoot "/opt/www/www.demoi02.com" ServerName www.demo02.com ServerAlias demo02.com. *.demo02.com </VirtualHost> <Directory "/opt/www/www.demo02.com"> Options Indexes FollowSymLinks AllowOverride all Order Deny,Allow Allow from all Require all granted DirectoryIndex index.html index.htm index.php #主页文件的设置 </Directory> <VirtualHost 46.37.177.155:80> DocumentRoot "/opt/www/www.demoi03.com" ServerName www.demo03.com ServerAlias demo03.com. *.demo03.com </VirtualHost> <Directory "/opt/www/www.demo03.com"> Options Indexes FollowSymLinks AllowOverride all Order Deny,Allow Allow from all Require all granted DirectoryIndex index.html index.htm index.php #主页文件的设置 </Directory> </code></pre>

发表评论

暂无评论

搜索
用户登陆