歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Ubuntu下Apache2多站點配置實例講解

Ubuntu下Apache2多站點配置實例講解

日期:2017/2/28 17:44:51   编辑:Linux教程

安裝完畢apache後,不需要修改任何配置文件,包括 httpd.conf 、 httpd.conf 和 apache2.conf 配置文件。

more /etc/apache2/sites-available/site1.xxxx.com
代碼:
<VirtualHost *>
ServerAdmin webmaster@localhost
ServerName site1.xxxx.com
CustomLog /var/log/apache2/site1.xxxx.com-access.log combined
DocumentRoot /var/www/site1/
<Directory /var/www/site1/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
</VirtualHost>


more /etc/apache2/sites-available/site2.xxxx.com
代碼:
<VirtualHost *>
ServerAdmin webmaster@localhost
ServerName site2.xxxx.com
ServerAlias site2.yyyy.com
CustomLog /var/log/apache2/site2.xxxx.com-access.log combined
DocumentRoot /web/site2
<Directory /web/site2>
Options Indexes
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>


創建完畢後,直接
sudo ln -s /etc/apache2/sites-available/site1.xxxx.com /etc/apache2/sites-enabled/site1.xxxx.com
sudo ln -s /etc/apache2/sites-available/site2.xxxx.com /etc/apache2/sites-enabled/site2.xxxx.com

Copyright © Linux教程網 All Rights Reserved